mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Issue #1971 - Part 2: Update ICU source to 63.2.
This commit is contained in:
parent
8df84683be
commit
1e69214382
3160 changed files with 275815 additions and 234203 deletions
115
config/external/icu/common/sources.mozbuild
vendored
115
config/external/icu/common/sources.mozbuild
vendored
|
|
@ -4,26 +4,28 @@ SOURCES += [
|
|||
'/intl/icu/source/common/bmpset.cpp',
|
||||
'/intl/icu/source/common/brkeng.cpp',
|
||||
'/intl/icu/source/common/brkiter.cpp',
|
||||
'/intl/icu/source/common/bytesinkutil.cpp',
|
||||
'/intl/icu/source/common/bytestream.cpp',
|
||||
'/intl/icu/source/common/bytestrie.cpp',
|
||||
'/intl/icu/source/common/bytestriebuilder.cpp',
|
||||
'/intl/icu/source/common/bytestrieiterator.cpp',
|
||||
'/intl/icu/source/common/caniter.cpp',
|
||||
'/intl/icu/source/common/characterproperties.cpp',
|
||||
'/intl/icu/source/common/chariter.cpp',
|
||||
'/intl/icu/source/common/charstr.cpp',
|
||||
'/intl/icu/source/common/cmemory.c',
|
||||
'/intl/icu/source/common/cmemory.cpp',
|
||||
'/intl/icu/source/common/cstr.cpp',
|
||||
'/intl/icu/source/common/cstring.c',
|
||||
'/intl/icu/source/common/cwchar.c',
|
||||
'/intl/icu/source/common/cstring.cpp',
|
||||
'/intl/icu/source/common/cwchar.cpp',
|
||||
'/intl/icu/source/common/dictbe.cpp',
|
||||
'/intl/icu/source/common/dictionarydata.cpp',
|
||||
'/intl/icu/source/common/dtintrv.cpp',
|
||||
'/intl/icu/source/common/edits.cpp',
|
||||
'/intl/icu/source/common/errorcode.cpp',
|
||||
'/intl/icu/source/common/filteredbrk.cpp',
|
||||
'/intl/icu/source/common/filterednormalizer2.cpp',
|
||||
'/intl/icu/source/common/icudataver.c',
|
||||
'/intl/icu/source/common/icudataver.cpp',
|
||||
'/intl/icu/source/common/icuplug.cpp',
|
||||
'/intl/icu/source/common/listformatter.cpp',
|
||||
'/intl/icu/source/common/loadednormalizer2impl.cpp',
|
||||
'/intl/icu/source/common/locavailable.cpp',
|
||||
'/intl/icu/source/common/locbased.cpp',
|
||||
|
|
@ -31,7 +33,7 @@ SOURCES += [
|
|||
'/intl/icu/source/common/locdspnm.cpp',
|
||||
'/intl/icu/source/common/locid.cpp',
|
||||
'/intl/icu/source/common/loclikely.cpp',
|
||||
'/intl/icu/source/common/locmap.c',
|
||||
'/intl/icu/source/common/locmap.cpp',
|
||||
'/intl/icu/source/common/locresdata.cpp',
|
||||
'/intl/icu/source/common/locutil.cpp',
|
||||
'/intl/icu/source/common/messagepattern.cpp',
|
||||
|
|
@ -42,10 +44,11 @@ SOURCES += [
|
|||
'/intl/icu/source/common/patternprops.cpp',
|
||||
'/intl/icu/source/common/pluralmap.cpp',
|
||||
'/intl/icu/source/common/propname.cpp',
|
||||
'/intl/icu/source/common/propsvec.c',
|
||||
'/intl/icu/source/common/propsvec.cpp',
|
||||
'/intl/icu/source/common/punycode.cpp',
|
||||
'/intl/icu/source/common/putil.cpp',
|
||||
'/intl/icu/source/common/rbbi.cpp',
|
||||
'/intl/icu/source/common/rbbi_cache.cpp',
|
||||
'/intl/icu/source/common/rbbidata.cpp',
|
||||
'/intl/icu/source/common/rbbinode.cpp',
|
||||
'/intl/icu/source/common/rbbirb.cpp',
|
||||
|
|
@ -67,68 +70,70 @@ SOURCES += [
|
|||
'/intl/icu/source/common/servslkf.cpp',
|
||||
'/intl/icu/source/common/sharedobject.cpp',
|
||||
'/intl/icu/source/common/simpleformatter.cpp',
|
||||
'/intl/icu/source/common/static_unicode_sets.cpp',
|
||||
'/intl/icu/source/common/stringpiece.cpp',
|
||||
'/intl/icu/source/common/stringtriebuilder.cpp',
|
||||
'/intl/icu/source/common/uarrsort.c',
|
||||
'/intl/icu/source/common/ubidi.c',
|
||||
'/intl/icu/source/common/ubidi_props.c',
|
||||
'/intl/icu/source/common/ubidiln.c',
|
||||
'/intl/icu/source/common/ubiditransform.c',
|
||||
'/intl/icu/source/common/ubidiwrt.c',
|
||||
'/intl/icu/source/common/uarrsort.cpp',
|
||||
'/intl/icu/source/common/ubidi.cpp',
|
||||
'/intl/icu/source/common/ubidi_props.cpp',
|
||||
'/intl/icu/source/common/ubidiln.cpp',
|
||||
'/intl/icu/source/common/ubiditransform.cpp',
|
||||
'/intl/icu/source/common/ubidiwrt.cpp',
|
||||
'/intl/icu/source/common/ubrk.cpp',
|
||||
'/intl/icu/source/common/ucase.cpp',
|
||||
'/intl/icu/source/common/ucasemap.cpp',
|
||||
'/intl/icu/source/common/ucasemap_titlecase_brkiter.cpp',
|
||||
'/intl/icu/source/common/ucat.c',
|
||||
'/intl/icu/source/common/uchar.c',
|
||||
'/intl/icu/source/common/ucat.cpp',
|
||||
'/intl/icu/source/common/uchar.cpp',
|
||||
'/intl/icu/source/common/ucharstrie.cpp',
|
||||
'/intl/icu/source/common/ucharstriebuilder.cpp',
|
||||
'/intl/icu/source/common/ucharstrieiterator.cpp',
|
||||
'/intl/icu/source/common/uchriter.cpp',
|
||||
'/intl/icu/source/common/ucln_cmn.cpp',
|
||||
'/intl/icu/source/common/ucmndata.c',
|
||||
'/intl/icu/source/common/ucnv.c',
|
||||
'/intl/icu/source/common/ucmndata.cpp',
|
||||
'/intl/icu/source/common/ucnv.cpp',
|
||||
'/intl/icu/source/common/ucnv2022.cpp',
|
||||
'/intl/icu/source/common/ucnv_bld.cpp',
|
||||
'/intl/icu/source/common/ucnv_cb.c',
|
||||
'/intl/icu/source/common/ucnv_cnv.c',
|
||||
'/intl/icu/source/common/ucnv_ct.c',
|
||||
'/intl/icu/source/common/ucnv_err.c',
|
||||
'/intl/icu/source/common/ucnv_cb.cpp',
|
||||
'/intl/icu/source/common/ucnv_cnv.cpp',
|
||||
'/intl/icu/source/common/ucnv_ct.cpp',
|
||||
'/intl/icu/source/common/ucnv_err.cpp',
|
||||
'/intl/icu/source/common/ucnv_ext.cpp',
|
||||
'/intl/icu/source/common/ucnv_io.cpp',
|
||||
'/intl/icu/source/common/ucnv_lmb.c',
|
||||
'/intl/icu/source/common/ucnv_set.c',
|
||||
'/intl/icu/source/common/ucnv_u16.c',
|
||||
'/intl/icu/source/common/ucnv_u32.c',
|
||||
'/intl/icu/source/common/ucnv_u7.c',
|
||||
'/intl/icu/source/common/ucnv_u8.c',
|
||||
'/intl/icu/source/common/ucnv_lmb.cpp',
|
||||
'/intl/icu/source/common/ucnv_set.cpp',
|
||||
'/intl/icu/source/common/ucnv_u16.cpp',
|
||||
'/intl/icu/source/common/ucnv_u32.cpp',
|
||||
'/intl/icu/source/common/ucnv_u7.cpp',
|
||||
'/intl/icu/source/common/ucnv_u8.cpp',
|
||||
'/intl/icu/source/common/ucnvbocu.cpp',
|
||||
'/intl/icu/source/common/ucnvdisp.c',
|
||||
'/intl/icu/source/common/ucnvhz.c',
|
||||
'/intl/icu/source/common/ucnvisci.c',
|
||||
'/intl/icu/source/common/ucnvlat1.c',
|
||||
'/intl/icu/source/common/ucnvdisp.cpp',
|
||||
'/intl/icu/source/common/ucnvhz.cpp',
|
||||
'/intl/icu/source/common/ucnvisci.cpp',
|
||||
'/intl/icu/source/common/ucnvlat1.cpp',
|
||||
'/intl/icu/source/common/ucnvmbcs.cpp',
|
||||
'/intl/icu/source/common/ucnvscsu.c',
|
||||
'/intl/icu/source/common/ucnvscsu.cpp',
|
||||
'/intl/icu/source/common/ucnvsel.cpp',
|
||||
'/intl/icu/source/common/ucol_swp.cpp',
|
||||
'/intl/icu/source/common/ucptrie.cpp',
|
||||
'/intl/icu/source/common/ucurr.cpp',
|
||||
'/intl/icu/source/common/udata.cpp',
|
||||
'/intl/icu/source/common/udatamem.c',
|
||||
'/intl/icu/source/common/udataswp.c',
|
||||
'/intl/icu/source/common/uenum.c',
|
||||
'/intl/icu/source/common/uhash.c',
|
||||
'/intl/icu/source/common/udatamem.cpp',
|
||||
'/intl/icu/source/common/udataswp.cpp',
|
||||
'/intl/icu/source/common/uenum.cpp',
|
||||
'/intl/icu/source/common/uhash.cpp',
|
||||
'/intl/icu/source/common/uhash_us.cpp',
|
||||
'/intl/icu/source/common/uidna.cpp',
|
||||
'/intl/icu/source/common/uinit.cpp',
|
||||
'/intl/icu/source/common/uinvchar.c',
|
||||
'/intl/icu/source/common/uinvchar.cpp',
|
||||
'/intl/icu/source/common/uiter.cpp',
|
||||
'/intl/icu/source/common/ulist.c',
|
||||
'/intl/icu/source/common/ulistformatter.cpp',
|
||||
'/intl/icu/source/common/ulist.cpp',
|
||||
'/intl/icu/source/common/uloc.cpp',
|
||||
'/intl/icu/source/common/uloc_keytype.cpp',
|
||||
'/intl/icu/source/common/uloc_tag.c',
|
||||
'/intl/icu/source/common/umapfile.c',
|
||||
'/intl/icu/source/common/umath.c',
|
||||
'/intl/icu/source/common/uloc_tag.cpp',
|
||||
'/intl/icu/source/common/umapfile.cpp',
|
||||
'/intl/icu/source/common/umath.cpp',
|
||||
'/intl/icu/source/common/umutablecptrie.cpp',
|
||||
'/intl/icu/source/common/umutex.cpp',
|
||||
'/intl/icu/source/common/unames.cpp',
|
||||
'/intl/icu/source/common/unifiedcache.cpp',
|
||||
|
|
@ -148,11 +153,11 @@ SOURCES += [
|
|||
'/intl/icu/source/common/unormcmp.cpp',
|
||||
'/intl/icu/source/common/uobject.cpp',
|
||||
'/intl/icu/source/common/uprops.cpp',
|
||||
'/intl/icu/source/common/ures_cnv.c',
|
||||
'/intl/icu/source/common/ures_cnv.cpp',
|
||||
'/intl/icu/source/common/uresbund.cpp',
|
||||
'/intl/icu/source/common/uresdata.cpp',
|
||||
'/intl/icu/source/common/usc_impl.c',
|
||||
'/intl/icu/source/common/uscript.c',
|
||||
'/intl/icu/source/common/usc_impl.cpp',
|
||||
'/intl/icu/source/common/uscript.cpp',
|
||||
'/intl/icu/source/common/uscript_props.cpp',
|
||||
'/intl/icu/source/common/uset.cpp',
|
||||
'/intl/icu/source/common/uset_props.cpp',
|
||||
|
|
@ -166,23 +171,24 @@ SOURCES += [
|
|||
'/intl/icu/source/common/ustrcase.cpp',
|
||||
'/intl/icu/source/common/ustrcase_locale.cpp',
|
||||
'/intl/icu/source/common/ustrenum.cpp',
|
||||
'/intl/icu/source/common/ustrfmt.c',
|
||||
'/intl/icu/source/common/ustrfmt.cpp',
|
||||
'/intl/icu/source/common/ustring.cpp',
|
||||
'/intl/icu/source/common/ustrtrns.cpp',
|
||||
'/intl/icu/source/common/utext.cpp',
|
||||
'/intl/icu/source/common/utf_impl.c',
|
||||
'/intl/icu/source/common/utf_impl.cpp',
|
||||
'/intl/icu/source/common/util.cpp',
|
||||
'/intl/icu/source/common/util_props.cpp',
|
||||
'/intl/icu/source/common/utrace.c',
|
||||
'/intl/icu/source/common/utrace.cpp',
|
||||
'/intl/icu/source/common/utrie.cpp',
|
||||
'/intl/icu/source/common/utrie2.cpp',
|
||||
'/intl/icu/source/common/utrie2_builder.cpp',
|
||||
'/intl/icu/source/common/utrie_swap.cpp',
|
||||
'/intl/icu/source/common/uts46.cpp',
|
||||
'/intl/icu/source/common/utypes.c',
|
||||
'/intl/icu/source/common/utypes.cpp',
|
||||
'/intl/icu/source/common/uvector.cpp',
|
||||
'/intl/icu/source/common/uvectr32.cpp',
|
||||
'/intl/icu/source/common/uvectr64.cpp',
|
||||
'/intl/icu/source/common/wintz.c',
|
||||
'/intl/icu/source/common/wintz.cpp',
|
||||
]
|
||||
|
||||
EXPORTS.unicode += [
|
||||
|
|
@ -192,17 +198,19 @@ EXPORTS.unicode += [
|
|||
'/intl/icu/source/common/unicode/bytestrie.h',
|
||||
'/intl/icu/source/common/unicode/bytestriebuilder.h',
|
||||
'/intl/icu/source/common/unicode/caniter.h',
|
||||
'/intl/icu/source/common/unicode/casemap.h',
|
||||
'/intl/icu/source/common/unicode/char16ptr.h',
|
||||
'/intl/icu/source/common/unicode/chariter.h',
|
||||
'/intl/icu/source/common/unicode/dbbi.h',
|
||||
'/intl/icu/source/common/unicode/docmain.h',
|
||||
'/intl/icu/source/common/unicode/dtintrv.h',
|
||||
'/intl/icu/source/common/unicode/edits.h',
|
||||
'/intl/icu/source/common/unicode/enumset.h',
|
||||
'/intl/icu/source/common/unicode/errorcode.h',
|
||||
'/intl/icu/source/common/unicode/filteredbrk.h',
|
||||
'/intl/icu/source/common/unicode/icudataver.h',
|
||||
'/intl/icu/source/common/unicode/icuplug.h',
|
||||
'/intl/icu/source/common/unicode/idna.h',
|
||||
'/intl/icu/source/common/unicode/listformatter.h',
|
||||
'/intl/icu/source/common/unicode/localpointer.h',
|
||||
'/intl/icu/source/common/unicode/locdspnm.h',
|
||||
'/intl/icu/source/common/unicode/locid.h',
|
||||
|
|
@ -221,6 +229,7 @@ EXPORTS.unicode += [
|
|||
'/intl/icu/source/common/unicode/simpleformatter.h',
|
||||
'/intl/icu/source/common/unicode/std_string.h',
|
||||
'/intl/icu/source/common/unicode/strenum.h',
|
||||
'/intl/icu/source/common/unicode/stringoptions.h',
|
||||
'/intl/icu/source/common/unicode/stringpiece.h',
|
||||
'/intl/icu/source/common/unicode/stringtriebuilder.h',
|
||||
'/intl/icu/source/common/unicode/symtable.h',
|
||||
|
|
@ -239,6 +248,8 @@ EXPORTS.unicode += [
|
|||
'/intl/icu/source/common/unicode/ucnv_err.h',
|
||||
'/intl/icu/source/common/unicode/ucnvsel.h',
|
||||
'/intl/icu/source/common/unicode/uconfig.h',
|
||||
'/intl/icu/source/common/unicode/ucpmap.h',
|
||||
'/intl/icu/source/common/unicode/ucptrie.h',
|
||||
'/intl/icu/source/common/unicode/ucurr.h',
|
||||
'/intl/icu/source/common/unicode/udata.h',
|
||||
'/intl/icu/source/common/unicode/udisplaycontext.h',
|
||||
|
|
@ -246,10 +257,10 @@ EXPORTS.unicode += [
|
|||
'/intl/icu/source/common/unicode/uidna.h',
|
||||
'/intl/icu/source/common/unicode/uiter.h',
|
||||
'/intl/icu/source/common/unicode/uldnames.h',
|
||||
'/intl/icu/source/common/unicode/ulistformatter.h',
|
||||
'/intl/icu/source/common/unicode/uloc.h',
|
||||
'/intl/icu/source/common/unicode/umachine.h',
|
||||
'/intl/icu/source/common/unicode/umisc.h',
|
||||
'/intl/icu/source/common/unicode/umutablecptrie.h',
|
||||
'/intl/icu/source/common/unicode/unifilt.h',
|
||||
'/intl/icu/source/common/unicode/unifunct.h',
|
||||
'/intl/icu/source/common/unicode/unimatch.h',
|
||||
|
|
|
|||
Binary file not shown.
76
config/external/icu/i18n/sources.mozbuild
vendored
76
config/external/icu/i18n/sources.mozbuild
vendored
|
|
@ -1,6 +1,5 @@
|
|||
# THIS FILE IS GENERATED BY /intl/icu_sources_data.py DO NOT EDIT
|
||||
SOURCES += [
|
||||
'/intl/icu/source/i18n/affixpatternparser.cpp',
|
||||
'/intl/icu/source/i18n/alphaindex.cpp',
|
||||
'/intl/icu/source/i18n/anytrans.cpp',
|
||||
'/intl/icu/source/i18n/astro.cpp',
|
||||
|
|
@ -53,23 +52,22 @@ SOURCES += [
|
|||
'/intl/icu/source/i18n/datefmt.cpp',
|
||||
'/intl/icu/source/i18n/dayperiodrules.cpp',
|
||||
'/intl/icu/source/i18n/dcfmtsym.cpp',
|
||||
'/intl/icu/source/i18n/decContext.c',
|
||||
'/intl/icu/source/i18n/decfmtst.cpp',
|
||||
'/intl/icu/source/i18n/decimalformatpattern.cpp',
|
||||
'/intl/icu/source/i18n/decContext.cpp',
|
||||
'/intl/icu/source/i18n/decimfmt.cpp',
|
||||
'/intl/icu/source/i18n/decimfmtimpl.cpp',
|
||||
'/intl/icu/source/i18n/decNumber.c',
|
||||
'/intl/icu/source/i18n/digitaffix.cpp',
|
||||
'/intl/icu/source/i18n/digitaffixesandpadding.cpp',
|
||||
'/intl/icu/source/i18n/digitformatter.cpp',
|
||||
'/intl/icu/source/i18n/digitgrouping.cpp',
|
||||
'/intl/icu/source/i18n/digitinterval.cpp',
|
||||
'/intl/icu/source/i18n/digitlst.cpp',
|
||||
'/intl/icu/source/i18n/decNumber.cpp',
|
||||
'/intl/icu/source/i18n/double-conversion-bignum-dtoa.cpp',
|
||||
'/intl/icu/source/i18n/double-conversion-bignum.cpp',
|
||||
'/intl/icu/source/i18n/double-conversion-cached-powers.cpp',
|
||||
'/intl/icu/source/i18n/double-conversion-diy-fp.cpp',
|
||||
'/intl/icu/source/i18n/double-conversion-fast-dtoa.cpp',
|
||||
'/intl/icu/source/i18n/double-conversion-strtod.cpp',
|
||||
'/intl/icu/source/i18n/double-conversion.cpp',
|
||||
'/intl/icu/source/i18n/dtfmtsym.cpp',
|
||||
'/intl/icu/source/i18n/dtitvfmt.cpp',
|
||||
'/intl/icu/source/i18n/dtitvinf.cpp',
|
||||
'/intl/icu/source/i18n/dtptngen.cpp',
|
||||
'/intl/icu/source/i18n/dtrule.cpp',
|
||||
'/intl/icu/source/i18n/erarules.cpp',
|
||||
'/intl/icu/source/i18n/esctrn.cpp',
|
||||
'/intl/icu/source/i18n/ethpccal.cpp',
|
||||
'/intl/icu/source/i18n/fmtable.cpp',
|
||||
|
|
@ -86,6 +84,7 @@ SOURCES += [
|
|||
'/intl/icu/source/i18n/inputext.cpp',
|
||||
'/intl/icu/source/i18n/islamcal.cpp',
|
||||
'/intl/icu/source/i18n/japancal.cpp',
|
||||
'/intl/icu/source/i18n/listformatter.cpp',
|
||||
'/intl/icu/source/i18n/measfmt.cpp',
|
||||
'/intl/icu/source/i18n/measunit.cpp',
|
||||
'/intl/icu/source/i18n/measure.cpp',
|
||||
|
|
@ -95,15 +94,50 @@ SOURCES += [
|
|||
'/intl/icu/source/i18n/nfrule.cpp',
|
||||
'/intl/icu/source/i18n/nfsubs.cpp',
|
||||
'/intl/icu/source/i18n/nortrans.cpp',
|
||||
'/intl/icu/source/i18n/nounit.cpp',
|
||||
'/intl/icu/source/i18n/nultrans.cpp',
|
||||
'/intl/icu/source/i18n/number_affixutils.cpp',
|
||||
'/intl/icu/source/i18n/number_asformat.cpp',
|
||||
'/intl/icu/source/i18n/number_capi.cpp',
|
||||
'/intl/icu/source/i18n/number_compact.cpp',
|
||||
'/intl/icu/source/i18n/number_currencysymbols.cpp',
|
||||
'/intl/icu/source/i18n/number_decimalquantity.cpp',
|
||||
'/intl/icu/source/i18n/number_decimfmtprops.cpp',
|
||||
'/intl/icu/source/i18n/number_fluent.cpp',
|
||||
'/intl/icu/source/i18n/number_formatimpl.cpp',
|
||||
'/intl/icu/source/i18n/number_grouping.cpp',
|
||||
'/intl/icu/source/i18n/number_integerwidth.cpp',
|
||||
'/intl/icu/source/i18n/number_longnames.cpp',
|
||||
'/intl/icu/source/i18n/number_mapper.cpp',
|
||||
'/intl/icu/source/i18n/number_modifiers.cpp',
|
||||
'/intl/icu/source/i18n/number_multiplier.cpp',
|
||||
'/intl/icu/source/i18n/number_notation.cpp',
|
||||
'/intl/icu/source/i18n/number_padding.cpp',
|
||||
'/intl/icu/source/i18n/number_patternmodifier.cpp',
|
||||
'/intl/icu/source/i18n/number_patternstring.cpp',
|
||||
'/intl/icu/source/i18n/number_rounding.cpp',
|
||||
'/intl/icu/source/i18n/number_scientific.cpp',
|
||||
'/intl/icu/source/i18n/number_skeletons.cpp',
|
||||
'/intl/icu/source/i18n/number_stringbuilder.cpp',
|
||||
'/intl/icu/source/i18n/number_utils.cpp',
|
||||
'/intl/icu/source/i18n/numfmt.cpp',
|
||||
'/intl/icu/source/i18n/numparse_affixes.cpp',
|
||||
'/intl/icu/source/i18n/numparse_compositions.cpp',
|
||||
'/intl/icu/source/i18n/numparse_currency.cpp',
|
||||
'/intl/icu/source/i18n/numparse_decimal.cpp',
|
||||
'/intl/icu/source/i18n/numparse_impl.cpp',
|
||||
'/intl/icu/source/i18n/numparse_parsednumber.cpp',
|
||||
'/intl/icu/source/i18n/numparse_scientific.cpp',
|
||||
'/intl/icu/source/i18n/numparse_stringsegment.cpp',
|
||||
'/intl/icu/source/i18n/numparse_symbols.cpp',
|
||||
'/intl/icu/source/i18n/numparse_validators.cpp',
|
||||
'/intl/icu/source/i18n/numrange_fluent.cpp',
|
||||
'/intl/icu/source/i18n/numrange_impl.cpp',
|
||||
'/intl/icu/source/i18n/numsys.cpp',
|
||||
'/intl/icu/source/i18n/olsontz.cpp',
|
||||
'/intl/icu/source/i18n/persncal.cpp',
|
||||
'/intl/icu/source/i18n/pluralaffix.cpp',
|
||||
'/intl/icu/source/i18n/plurfmt.cpp',
|
||||
'/intl/icu/source/i18n/plurrule.cpp',
|
||||
'/intl/icu/source/i18n/precision.cpp',
|
||||
'/intl/icu/source/i18n/quant.cpp',
|
||||
'/intl/icu/source/i18n/quantityformatter.cpp',
|
||||
'/intl/icu/source/i18n/rbnf.cpp',
|
||||
|
|
@ -130,7 +164,6 @@ SOURCES += [
|
|||
'/intl/icu/source/i18n/selfmt.cpp',
|
||||
'/intl/icu/source/i18n/sharedbreakiterator.cpp',
|
||||
'/intl/icu/source/i18n/simpletz.cpp',
|
||||
'/intl/icu/source/i18n/smallintformatter.cpp',
|
||||
'/intl/icu/source/i18n/smpdtfmt.cpp',
|
||||
'/intl/icu/source/i18n/smpdtfst.cpp',
|
||||
'/intl/icu/source/i18n/sortkey.cpp',
|
||||
|
|
@ -167,7 +200,8 @@ SOURCES += [
|
|||
'/intl/icu/source/i18n/udatpg.cpp',
|
||||
'/intl/icu/source/i18n/ufieldpositer.cpp',
|
||||
'/intl/icu/source/i18n/uitercollationiterator.cpp',
|
||||
'/intl/icu/source/i18n/ulocdata.c',
|
||||
'/intl/icu/source/i18n/ulistformatter.cpp',
|
||||
'/intl/icu/source/i18n/ulocdata.cpp',
|
||||
'/intl/icu/source/i18n/umsg.cpp',
|
||||
'/intl/icu/source/i18n/unesctrn.cpp',
|
||||
'/intl/icu/source/i18n/uni2name.cpp',
|
||||
|
|
@ -184,10 +218,8 @@ SOURCES += [
|
|||
'/intl/icu/source/i18n/uspoof_impl.cpp',
|
||||
'/intl/icu/source/i18n/utf16collationiterator.cpp',
|
||||
'/intl/icu/source/i18n/utf8collationiterator.cpp',
|
||||
'/intl/icu/source/i18n/utmscale.c',
|
||||
'/intl/icu/source/i18n/utmscale.cpp',
|
||||
'/intl/icu/source/i18n/utrans.cpp',
|
||||
'/intl/icu/source/i18n/valueformatter.cpp',
|
||||
'/intl/icu/source/i18n/visibledigits.cpp',
|
||||
'/intl/icu/source/i18n/vtzone.cpp',
|
||||
'/intl/icu/source/i18n/vzone.cpp',
|
||||
'/intl/icu/source/i18n/windtfmt.cpp',
|
||||
|
|
@ -223,10 +255,14 @@ EXPORTS.unicode += [
|
|||
'/intl/icu/source/i18n/unicode/fpositer.h',
|
||||
'/intl/icu/source/i18n/unicode/gender.h',
|
||||
'/intl/icu/source/i18n/unicode/gregocal.h',
|
||||
'/intl/icu/source/i18n/unicode/listformatter.h',
|
||||
'/intl/icu/source/i18n/unicode/measfmt.h',
|
||||
'/intl/icu/source/i18n/unicode/measunit.h',
|
||||
'/intl/icu/source/i18n/unicode/measure.h',
|
||||
'/intl/icu/source/i18n/unicode/msgfmt.h',
|
||||
'/intl/icu/source/i18n/unicode/nounit.h',
|
||||
'/intl/icu/source/i18n/unicode/numberformatter.h',
|
||||
'/intl/icu/source/i18n/unicode/numberrangeformatter.h',
|
||||
'/intl/icu/source/i18n/unicode/numfmt.h',
|
||||
'/intl/icu/source/i18n/unicode/numsys.h',
|
||||
'/intl/icu/source/i18n/unicode/plurfmt.h',
|
||||
|
|
@ -263,10 +299,12 @@ EXPORTS.unicode += [
|
|||
'/intl/icu/source/i18n/unicode/ufieldpositer.h',
|
||||
'/intl/icu/source/i18n/unicode/uformattable.h',
|
||||
'/intl/icu/source/i18n/unicode/ugender.h',
|
||||
'/intl/icu/source/i18n/unicode/ulistformatter.h',
|
||||
'/intl/icu/source/i18n/unicode/ulocdata.h',
|
||||
'/intl/icu/source/i18n/unicode/umsg.h',
|
||||
'/intl/icu/source/i18n/unicode/unirepl.h',
|
||||
'/intl/icu/source/i18n/unicode/unum.h',
|
||||
'/intl/icu/source/i18n/unicode/unumberformatter.h',
|
||||
'/intl/icu/source/i18n/unicode/unumsys.h',
|
||||
'/intl/icu/source/i18n/unicode/upluralrules.h',
|
||||
'/intl/icu/source/i18n/unicode/uregex.h',
|
||||
|
|
|
|||
2
config/external/icu/stubdata/moz.build
vendored
2
config/external/icu/stubdata/moz.build
vendored
|
|
@ -9,4 +9,4 @@
|
|||
|
||||
Library('icustubdata')
|
||||
|
||||
SOURCES += ['/intl/icu/source/stubdata/stubdata.c']
|
||||
SOURCES += ['/intl/icu/source/stubdata/stubdata.cpp']
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
commit 9248183bc6ab67503d03d4a6b4c842e77e3fd1b8
|
||||
Author: yumaoka <y.umaoka@gmail.com>
|
||||
Date: Wed Apr 10 00:49:25 2019 -0400
|
||||
commit 4f715ae124c418a15a3fa4d8fb14f406576a7ee5
|
||||
Author: Jeff Genovy <29107334+jefgen@users.noreply.github.com>
|
||||
Date: Wed Apr 10 17:32:11 2019 -0700
|
||||
|
||||
ICU-20536 ICU 58.3 release tasks
|
||||
ICU-20536 ICU 63.2 release tasks + tzdata2019a
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -34,9 +34,11 @@ subdir = .
|
|||
@LAYOUTEX_TRUE@LAYOUTEX = layoutex
|
||||
@ICUIO_TRUE@ICUIO = io
|
||||
@EXTRAS_TRUE@EXTRA = extra
|
||||
@TESTS_TRUE@TEST = test
|
||||
# need tools for tests
|
||||
@TOOLS_TRUE@@TESTS_TRUE@TEST = test
|
||||
@SAMPLES_TRUE@SAMPLE = samples
|
||||
@TOOLS_TRUE@TOOLS = tools
|
||||
@TOOLS_TRUE@DATASUBDIR = data
|
||||
|
||||
## pkgconfig setup. Always have uc and i18n. Others are optional.
|
||||
ALL_PKGCONFIG_SUFFIX=uc i18n
|
||||
|
|
@ -46,6 +48,8 @@ ALL_PKGCONFIG_SUFFIX=uc i18n
|
|||
DOXYGEN = @DOXYGEN@
|
||||
DOCZIP = icu-docs.zip
|
||||
|
||||
INSTALL_ICU_CONFIG = @INSTALL_ICU_CONFIG@
|
||||
|
||||
## Files to remove for 'make clean'
|
||||
CLEANFILES = *~
|
||||
|
||||
|
|
@ -58,11 +62,13 @@ INSTALLED_BUILT_FILES = $(top_builddir)/config/Makefile.inc $(top_builddir)/conf
|
|||
LOCAL_BUILT_FILES = icudefs.mk config/icucross.mk config/icucross.inc
|
||||
|
||||
DOCDIRS = common i18n
|
||||
SUBDIRS = stubdata common i18n $(LAYOUTEX) $(ICUIO) $(TOOLS) data $(EXTRA) $(SAMPLE) $(TEST)
|
||||
SUBDIRS = stubdata common i18n $(LAYOUTEX) $(ICUIO) $(TOOLS) $(DATASUBDIR) $(EXTRA) $(SAMPLE) $(TEST)
|
||||
|
||||
SECTION = 1
|
||||
|
||||
ifeq ($(INSTALL_ICU_CONFIG),true)
|
||||
MANX_FILES = config/icu-config.$(SECTION)
|
||||
endif
|
||||
|
||||
ALL_MAN_FILES = $(MANX_FILES)
|
||||
|
||||
|
|
@ -85,7 +91,7 @@ all: all-local all-recursive
|
|||
install: install-recursive install-local
|
||||
clean: clean-recursive-with-twist clean-local
|
||||
distclean : distclean-recursive distclean-local
|
||||
dist: dist-recursive dist-local
|
||||
dist: dist-recursive
|
||||
check: all check-recursive
|
||||
check-recursive: all
|
||||
xcheck: all xcheck-recursive
|
||||
|
|
@ -144,6 +150,10 @@ $(LIBDIR) $(BINDIR):
|
|||
## favor of RECURSIVE=YES when the submake in the subdirectory restarts itself
|
||||
## after dependency files have been created.
|
||||
all-recursive install-recursive clean-recursive distclean-recursive dist-recursive check-recursive check-exhaustive-recursive: $(LIBDIR) $(BINDIR)
|
||||
ifneq ($(NEED_ESCAPING),)
|
||||
@echo "building tools/escapesrc (Needed for this platform with NEED_ESCAPING)"
|
||||
@(cd tools/escapesrc && $(MAKE) $(MAKEOVERRIDES) RECURSIVE=YES $$local_target) || exit
|
||||
endif
|
||||
@dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(LOCAL_SUBDIRS)'; for subdir in $$list; do \
|
||||
|
|
@ -185,13 +195,15 @@ install-icu: $(INSTALLED_BUILT_FILES)
|
|||
@$(MKINSTALLDIRS) $(DESTDIR)$(libdir)/pkgconfig
|
||||
$(INSTALL_DATA) $(ALL_PKGCONFIG_FILES) $(DESTDIR)$(libdir)/pkgconfig/
|
||||
$(INSTALL_DATA) $(top_srcdir)/../LICENSE $(DESTDIR)$(pkgdatadir)/LICENSE
|
||||
ifeq ($(INSTALL_ICU_CONFIG),true)
|
||||
$(INSTALL_SCRIPT) $(top_builddir)/config/icu-config $(DESTDIR)$(bindir)/icu-config
|
||||
endif
|
||||
$(INSTALL_DATA) $(top_builddir)/config/Makefile.inc $(DESTDIR)$(pkglibdir)/Makefile.inc
|
||||
$(INSTALL_DATA) $(top_builddir)/config/pkgdata.inc $(DESTDIR)$(pkglibdir)/pkgdata.inc
|
||||
# @echo icuinfo.xml is built after make check.
|
||||
# -$(INSTALL_DATA) $(top_builddir)/config/icuinfo.xml $(DESTDIR)$(pkglibdir)/icuinfo.xml
|
||||
cd $(DESTDIR)$(pkglibdir)/..; \
|
||||
$(RM) current && ln -s $(VERSION) current; \
|
||||
$(RMV) current && ln -s $(VERSION) current; \
|
||||
$(RM) Makefile.inc && ln -s current/Makefile.inc Makefile.inc; \
|
||||
$(RM) pkgdata.inc && ln -s current/pkgdata.inc pkgdata.inc
|
||||
|
||||
|
|
@ -327,9 +339,10 @@ $(top_builddir)/config/icu-config: $(top_builddir)/Makefile $(top_srcdir)/config
|
|||
-$(RMV) $@
|
||||
$(INSTALL_SCRIPT) $(top_srcdir)/config/icu-config-top $@
|
||||
chmod u+w $@
|
||||
@echo "# Following from icu/icu4c/source/config/Makefile.inc" >> $@
|
||||
LC_ALL=C $(SED) -f $(top_srcdir)/config/make2sh.sed < $(top_builddir)/config/Makefile.inc | grep -v '#M#' | uniq >> $@
|
||||
@echo "# Following from @platform_make_fragment@" >> $@
|
||||
LC_ALL=C sed -f $(top_srcdir)/config/make2sh.sed < $(top_builddir)/config/Makefile.inc | grep -v '#M#' | uniq >> $@
|
||||
LC_ALL=C sed -f $(top_srcdir)/config/make2sh.sed < @platform_make_fragment@ | grep -v '#M#' | uniq >> $@
|
||||
LC_ALL=C $(SED) -f $(top_srcdir)/config/make2sh.sed < @platform_make_fragment@ | grep -v '#M#' | uniq >> $@
|
||||
cat $(top_srcdir)/config/icu-config-bottom >> $@
|
||||
chmod u-w $@
|
||||
|
||||
|
|
@ -347,7 +360,9 @@ config.status: $(srcdir)/configure $(srcdir)/common/unicode/uvernum.h
|
|||
|
||||
install-manx: $(MANX_FILES)
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
|
||||
ifneq ($(MANX_FILES),)
|
||||
$(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
|
||||
endif
|
||||
|
||||
config/%.$(SECTION): $(srcdir)/config/%.$(SECTION).in
|
||||
cd $(top_builddir) \
|
||||
|
|
|
|||
|
|
@ -464,12 +464,12 @@ AC_DEFUN([AC_CHECK_STRICT_COMPILE],
|
|||
then
|
||||
case "${host}" in
|
||||
*-*-solaris*)
|
||||
# Don't use -std=c99 on Solaris because of timezone check fails
|
||||
# Don't use -std=c11 on Solaris because of timezone check fails
|
||||
;;
|
||||
*)
|
||||
# Do not use -ansi. It limits us to C90, and it breaks some platforms.
|
||||
# We use -std=c99 to disable the gnu99 defaults and its associated warnings
|
||||
CFLAGS="$CFLAGS -std=c99"
|
||||
# We use -std=c11 to disable the gnu99 defaults and its associated warnings
|
||||
CFLAGS="$CFLAGS -std=c11"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html -->
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!-- This file is used to set configurations that are common to *all* ICU library code (common, i18n, and io). -->
|
||||
<!-- Note: These options are for *all* configurations for *all* library projects. -->
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<!-- ICU does not use exceptions in library code. -->
|
||||
<PreprocessorDefinitions>
|
||||
_HAS_EXCEPTIONS=0;
|
||||
%(PreprocessorDefinitions)
|
||||
</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<PropertyGroup>
|
||||
<!-- Disable MSBuild warning about Linker OutputFile. -->
|
||||
<!-- Ex: MSBuild complains that the common project creates "icuuc62.dll" rather than "common.dll". However, this is intentional. -->
|
||||
<MSBuildWarningsAsMessages>MSB8012</MSBuildWarningsAsMessages>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html -->
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!-- This file is used to set default configuration options for all non-UWP Visual Studio projects. -->
|
||||
<!-- These are the default project configurations for building. -->
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<!-- This is the version of the MSVC tool-set to use. -->
|
||||
<!-- v140 is the Visual Studio 2015 toolset. -->
|
||||
<!-- v141 is the Visual Studio 2017 toolset. -->
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<!-- This is the default SDK target. -->
|
||||
<!-- Note that the Windows 8.1 SDK is backwards compatible down-level to Windows 7, so
|
||||
setting this to 8.1 does not actually imply targeting Windows 8.1. -->
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<!-- We need to explicitly set the target version to Windows 7. -->
|
||||
<Win32_WinNTVersion>0x0601</Win32_WinNTVersion>
|
||||
</PropertyGroup>
|
||||
<!-- Options that are common to *all* configurations for *all* projects. -->
|
||||
<ItemDefinitionGroup>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<!-- Note: These preprocessor defines are for *all* configurations for *all* projects. -->
|
||||
<!-- Note: See ticket #5750 for the macro '_CRT_SECURE_NO_DEPRECATE'. -->
|
||||
<PreprocessorDefinitions>
|
||||
WINVER=$(Win32_WinNTVersion);
|
||||
_WIN32_WINNT=$(Win32_WinNTVersion);
|
||||
_CRT_SECURE_NO_DEPRECATE;
|
||||
%(PreprocessorDefinitions)
|
||||
</PreprocessorDefinitions>
|
||||
<!-- We always want to treat wchar_t as a "real" C++ type, instead of a typedef. -->
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<!-- Set the source encoding and runtime encoding to UTF-8 by default. -->
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
<!-- Enable parallel compilation for faster builds. -->
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Options that are common to all 'Release' configurations for *all* projects. -->
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Options that are common to all 'Debug' configurations for *all* projects. -->
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Options that are common to all 32-bit configurations for *all* projects. -->
|
||||
<ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
|
||||
<Midl>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Options that are common to all 64-bit configurations for *all* projects. -->
|
||||
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN64;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html -->
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!-- This file is used to set common configuration options for all *_uwp projects. -->
|
||||
<PropertyGroup>
|
||||
<!-- If not already set, use this version of the Win10 SDK -->
|
||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||
<!-- If not already set, set the minimum Win10 SDK version to TH1/RTM -->
|
||||
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
|
||||
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<!-- This is the version of the MSVC tool-set to use. -->
|
||||
<!-- v141 is the Visual Studio 2017 toolset. -->
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>
|
||||
%(PreprocessorDefinitions)
|
||||
U_PLATFORM_HAS_WINUWP_API=1;
|
||||
</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>
|
||||
%(PreprocessorDefinitions);
|
||||
U_PLATFORM_HAS_WINUWP_API=1;
|
||||
</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>
|
||||
%(PreprocessorDefinitions)
|
||||
U_PLATFORM_HAS_WINUWP_API=1;
|
||||
</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html -->
|
||||
<!--
|
||||
This file is used to copy all of the header files (*.h) from a project's "unicode" folder to a common output folder.
|
||||
-->
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<!-- This is the location of the common output folder. -->
|
||||
<CopyDestionationPath>$(SolutionDir)\..\..\include\unicode</CopyDestionationPath>
|
||||
<BuildDependsOn>
|
||||
$(BuildDependsOn);
|
||||
CopyUnicodeHeaderFiles;
|
||||
</BuildDependsOn>
|
||||
</PropertyGroup>
|
||||
<Target Name="CopyUnicodeHeaderFiles">
|
||||
<ItemGroup>
|
||||
<!-- Generate a list of all files that end in .h from the 'unicode' folder, relative to the current project. -->
|
||||
<OutputFiles Include=".\unicode\**\*.h" />
|
||||
</ItemGroup>
|
||||
<!-- This message will be logged in the project's build output. -->
|
||||
<Message Text="Copying @(OutputFiles->Count()) header files to $(CopyDestionationPath). Files copied: @(OutputFiles)" Importance="high"/>
|
||||
<!-- Perform the copy. -->
|
||||
<Copy SourceFiles="@(OutputFiles)"
|
||||
DestinationFolder="$(CopyDestionationPath)\%(RecursiveDir)"
|
||||
SkipUnchangedFiles="false"></Copy>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
@ -1,328 +1,544 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2036
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cal", "..\samples\cal\cal.vcxproj", "{F7659D77-09CF-4FE9-ACEE-927287AA9509}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cintltst", "..\test\cintltst\cintltst.vcxproj", "{3D1246AE-1B32-479B-BECA-AEFA97BE2321}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47} = {ECA6B435-B4FA-4F9F-BF95-F451D078FC47}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\common\common.vcxproj", "{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{203EC78A-0531-43F0-A636-285439BDE025} = {203EC78A-0531-43F0-A636-285439BDE025}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ctestfw", "..\tools\ctestfw\ctestfw.vcxproj", "{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "date", "..\samples\date\date.vcxproj", "{38B5751A-C6F9-4409-950C-F4F9DA17275F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "derb", "..\tools\genrb\derb.vcxproj", "{D3065ADB-8820-4CC7-9B6C-9510833961A3}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C} = {C2B04507-2521-4801-BF0D-5FD79D6D518C}
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genbrk", "..\tools\genbrk\genbrk.vcxproj", "{C2BE5000-7501-4E87-9724-B8D82494FAE6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genccode", "..\tools\genccode\genccode.vcxproj", "{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencmn", "..\tools\gencmn\gencmn.vcxproj", "{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencnval", "..\tools\gencnval\gencnval.vcxproj", "{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genrb", "..\tools\genrb\genrb.vcxproj", "{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gentest", "..\tools\gentest\gentest.vcxproj", "{77C78066-746F-4EA6-B3FE-B8C8A4A97891}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47} = {ECA6B435-B4FA-4F9F-BF95-F451D078FC47}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "i18n", "..\i18n\i18n.vcxproj", "{0178B127-6269-407D-B112-93877BB62776}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intltest", "..\test\intltest\intltest.vcxproj", "{73632960-B3A6-464D-83A3-4B43365F19B8}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47} = {ECA6B435-B4FA-4F9F-BF95-F451D078FC47}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makeconv", "..\tools\makeconv\makeconv.vcxproj", "{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makedata", "..\data\makedata.vcxproj", "{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pkgdata", "..\tools\pkgdata\pkgdata.vcxproj", "{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stubdata", "..\stubdata\stubdata.vcxproj", "{203EC78A-0531-43F0-A636-285439BDE025}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "toolutil", "..\tools\toolutil\toolutil.vcxproj", "{6B231032-3CB5-4EED-9210-810D666A23A0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uconv", "..\extra\uconv\uconv.vcxproj", "{DBA4088D-F6F9-4F8F-8820-082A4765C16C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A} = {97521D06-EC47-45D4-8BD0-9E16B3F93B2A}
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC} = {4C8454FE-81D3-4CA3-9927-29BA96F03DAC}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "io", "..\io\io.vcxproj", "{C2B04507-2521-4801-BF0D-5FD79D6D518C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gensprep", "..\tools\gensprep\gensprep.vcxproj", "{631C23CE-6C1D-4875-88F0-85E0A42B36EA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iotest", "..\test\iotest\iotest.vcxproj", "{E4993E82-D68A-46CA-BAE0-9D35E172E46F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C} = {C2B04507-2521-4801-BF0D-5FD79D6D518C}
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47} = {ECA6B435-B4FA-4F9F-BF95-F451D078FC47}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icupkg", "..\tools\icupkg\icupkg.vcxproj", "{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gendict", "..\tools\gendict\gendict.vcxproj", "{9D4211F7-2C77-439C-82F0-30A4E43BA569}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencfu", "..\tools\gencfu\gencfu.vcxproj", "{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gennorm2", "..\tools\gennorm2\gennorm2.vcxproj", "{C7891A65-80AB-4245-912E-5F1E17B0E6C4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icuinfo", "..\tools\icuinfo\icuinfo.vcxproj", "{E7611F49-F088-4175-9446-6111444E72C8}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47} = {ECA6B435-B4FA-4F9F-BF95-F451D078FC47}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testplug", "..\tools\icuinfo\testplug.vcxproj", "{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makedata_uwp", "..\data\makedata_uwp.vcxproj", "{B1D53358-37BD-48BC-B27C-68BAF1E78508}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "i18n_uwp", "..\i18n\i18n_uwp.vcxproj", "{6786C051-383B-47E0-9E82-B8B994E06A25}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2} = {C10CF34B-3F79-430E-AD38-5A32DC0589C2}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common_uwp", "..\common\common_uwp.vcxproj", "{C10CF34B-3F79-430E-AD38-5A32DC0589C2}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SubversionScc) = preSolution
|
||||
Svn-Managed = True
|
||||
Manager = AnkhSVN - Subversion Support for Visual Studio
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|ARM = Release|ARM
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F7659D77-09CF-4FE9-ACEE-927287AA9509}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{F7659D77-09CF-4FE9-ACEE-927287AA9509}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F7659D77-09CF-4FE9-ACEE-927287AA9509}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F7659D77-09CF-4FE9-ACEE-927287AA9509}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F7659D77-09CF-4FE9-ACEE-927287AA9509}.Debug|x64.Build.0 = Debug|x64
|
||||
{F7659D77-09CF-4FE9-ACEE-927287AA9509}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{F7659D77-09CF-4FE9-ACEE-927287AA9509}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F7659D77-09CF-4FE9-ACEE-927287AA9509}.Release|Win32.Build.0 = Release|Win32
|
||||
{F7659D77-09CF-4FE9-ACEE-927287AA9509}.Release|x64.ActiveCfg = Release|x64
|
||||
{F7659D77-09CF-4FE9-ACEE-927287AA9509}.Release|x64.Build.0 = Release|x64
|
||||
{3D1246AE-1B32-479B-BECA-AEFA97BE2321}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{3D1246AE-1B32-479B-BECA-AEFA97BE2321}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3D1246AE-1B32-479B-BECA-AEFA97BE2321}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3D1246AE-1B32-479B-BECA-AEFA97BE2321}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3D1246AE-1B32-479B-BECA-AEFA97BE2321}.Debug|x64.Build.0 = Debug|x64
|
||||
{3D1246AE-1B32-479B-BECA-AEFA97BE2321}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{3D1246AE-1B32-479B-BECA-AEFA97BE2321}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3D1246AE-1B32-479B-BECA-AEFA97BE2321}.Release|Win32.Build.0 = Release|Win32
|
||||
{3D1246AE-1B32-479B-BECA-AEFA97BE2321}.Release|x64.ActiveCfg = Release|x64
|
||||
{3D1246AE-1B32-479B-BECA-AEFA97BE2321}.Release|x64.Build.0 = Release|x64
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}.Debug|x64.Build.0 = Debug|x64
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}.Release|Win32.Build.0 = Release|Win32
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}.Release|x64.ActiveCfg = Release|x64
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}.Release|x64.Build.0 = Release|x64
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Debug|x64.Build.0 = Debug|x64
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Release|Win32.Build.0 = Release|Win32
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Release|x64.ActiveCfg = Release|x64
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Release|x64.Build.0 = Release|x64
|
||||
{38B5751A-C6F9-4409-950C-F4F9DA17275F}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{38B5751A-C6F9-4409-950C-F4F9DA17275F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{38B5751A-C6F9-4409-950C-F4F9DA17275F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{38B5751A-C6F9-4409-950C-F4F9DA17275F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{38B5751A-C6F9-4409-950C-F4F9DA17275F}.Debug|x64.Build.0 = Debug|x64
|
||||
{38B5751A-C6F9-4409-950C-F4F9DA17275F}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{38B5751A-C6F9-4409-950C-F4F9DA17275F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{38B5751A-C6F9-4409-950C-F4F9DA17275F}.Release|Win32.Build.0 = Release|Win32
|
||||
{38B5751A-C6F9-4409-950C-F4F9DA17275F}.Release|x64.ActiveCfg = Release|x64
|
||||
{38B5751A-C6F9-4409-950C-F4F9DA17275F}.Release|x64.Build.0 = Release|x64
|
||||
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Debug|x64.Build.0 = Debug|x64
|
||||
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Release|Win32.Build.0 = Release|Win32
|
||||
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Release|x64.ActiveCfg = Release|x64
|
||||
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Release|x64.Build.0 = Release|x64
|
||||
{C2BE5000-7501-4E87-9724-B8D82494FAE6}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{C2BE5000-7501-4E87-9724-B8D82494FAE6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C2BE5000-7501-4E87-9724-B8D82494FAE6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C2BE5000-7501-4E87-9724-B8D82494FAE6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C2BE5000-7501-4E87-9724-B8D82494FAE6}.Debug|x64.Build.0 = Debug|x64
|
||||
{C2BE5000-7501-4E87-9724-B8D82494FAE6}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{C2BE5000-7501-4E87-9724-B8D82494FAE6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C2BE5000-7501-4E87-9724-B8D82494FAE6}.Release|Win32.Build.0 = Release|Win32
|
||||
{C2BE5000-7501-4E87-9724-B8D82494FAE6}.Release|x64.ActiveCfg = Release|x64
|
||||
{C2BE5000-7501-4E87-9724-B8D82494FAE6}.Release|x64.Build.0 = Release|x64
|
||||
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}.Debug|x64.Build.0 = Debug|x64
|
||||
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}.Release|Win32.Build.0 = Release|Win32
|
||||
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}.Release|x64.ActiveCfg = Release|x64
|
||||
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}.Release|x64.Build.0 = Release|x64
|
||||
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}.Debug|x64.Build.0 = Debug|x64
|
||||
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}.Release|Win32.Build.0 = Release|Win32
|
||||
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}.Release|x64.ActiveCfg = Release|x64
|
||||
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}.Release|x64.Build.0 = Release|x64
|
||||
{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}.Debug|x64.Build.0 = Debug|x64
|
||||
{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}.Release|Win32.Build.0 = Release|Win32
|
||||
{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}.Release|x64.ActiveCfg = Release|x64
|
||||
{8B41752B-5A52-41E4-B7E0-07921C0CC6BF}.Release|x64.Build.0 = Release|x64
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}.Debug|x64.Build.0 = Debug|x64
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}.Release|Win32.Build.0 = Release|Win32
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}.Release|x64.ActiveCfg = Release|x64
|
||||
{97521D06-EC47-45D4-8BD0-9E16B3F93B2A}.Release|x64.Build.0 = Release|x64
|
||||
{77C78066-746F-4EA6-B3FE-B8C8A4A97891}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{77C78066-746F-4EA6-B3FE-B8C8A4A97891}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{77C78066-746F-4EA6-B3FE-B8C8A4A97891}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{77C78066-746F-4EA6-B3FE-B8C8A4A97891}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{77C78066-746F-4EA6-B3FE-B8C8A4A97891}.Debug|x64.Build.0 = Debug|x64
|
||||
{77C78066-746F-4EA6-B3FE-B8C8A4A97891}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{77C78066-746F-4EA6-B3FE-B8C8A4A97891}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{77C78066-746F-4EA6-B3FE-B8C8A4A97891}.Release|Win32.Build.0 = Release|Win32
|
||||
{77C78066-746F-4EA6-B3FE-B8C8A4A97891}.Release|x64.ActiveCfg = Release|x64
|
||||
{77C78066-746F-4EA6-B3FE-B8C8A4A97891}.Release|x64.Build.0 = Release|x64
|
||||
{0178B127-6269-407D-B112-93877BB62776}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{0178B127-6269-407D-B112-93877BB62776}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0178B127-6269-407D-B112-93877BB62776}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0178B127-6269-407D-B112-93877BB62776}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0178B127-6269-407D-B112-93877BB62776}.Debug|x64.Build.0 = Debug|x64
|
||||
{0178B127-6269-407D-B112-93877BB62776}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{0178B127-6269-407D-B112-93877BB62776}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0178B127-6269-407D-B112-93877BB62776}.Release|Win32.Build.0 = Release|Win32
|
||||
{0178B127-6269-407D-B112-93877BB62776}.Release|x64.ActiveCfg = Release|x64
|
||||
{0178B127-6269-407D-B112-93877BB62776}.Release|x64.Build.0 = Release|x64
|
||||
{73632960-B3A6-464D-83A3-4B43365F19B8}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{73632960-B3A6-464D-83A3-4B43365F19B8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{73632960-B3A6-464D-83A3-4B43365F19B8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{73632960-B3A6-464D-83A3-4B43365F19B8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{73632960-B3A6-464D-83A3-4B43365F19B8}.Debug|x64.Build.0 = Debug|x64
|
||||
{73632960-B3A6-464D-83A3-4B43365F19B8}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{73632960-B3A6-464D-83A3-4B43365F19B8}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{73632960-B3A6-464D-83A3-4B43365F19B8}.Release|Win32.Build.0 = Release|Win32
|
||||
{73632960-B3A6-464D-83A3-4B43365F19B8}.Release|x64.ActiveCfg = Release|x64
|
||||
{73632960-B3A6-464D-83A3-4B43365F19B8}.Release|x64.Build.0 = Release|x64
|
||||
{C920062A-0647-4553-A3B2-37C58065664B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C920062A-0647-4553-A3B2-37C58065664B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C920062A-0647-4553-A3B2-37C58065664B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C920062A-0647-4553-A3B2-37C58065664B}.Debug|x64.Build.0 = Debug|x64
|
||||
{C920062A-0647-4553-A3B2-37C58065664B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C920062A-0647-4553-A3B2-37C58065664B}.Release|Win32.Build.0 = Release|Win32
|
||||
{C920062A-0647-4553-A3B2-37C58065664B}.Release|x64.ActiveCfg = Release|x64
|
||||
{C920062A-0647-4553-A3B2-37C58065664B}.Release|x64.Build.0 = Release|x64
|
||||
{37FC2C7F-1904-4811-8955-2F478830EAD1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{37FC2C7F-1904-4811-8955-2F478830EAD1}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{37FC2C7F-1904-4811-8955-2F478830EAD1}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{37FC2C7F-1904-4811-8955-2F478830EAD1}.Debug|x64.Build.0 = Debug|x64
|
||||
{37FC2C7F-1904-4811-8955-2F478830EAD1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{37FC2C7F-1904-4811-8955-2F478830EAD1}.Release|Win32.Build.0 = Release|Win32
|
||||
{37FC2C7F-1904-4811-8955-2F478830EAD1}.Release|x64.ActiveCfg = Release|x64
|
||||
{37FC2C7F-1904-4811-8955-2F478830EAD1}.Release|x64.Build.0 = Release|x64
|
||||
{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}.Debug|x64.Build.0 = Debug|x64
|
||||
{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}.Release|Win32.Build.0 = Release|Win32
|
||||
{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}.Release|x64.ActiveCfg = Release|x64
|
||||
{F5AD9738-1A3D-4906-B9C4-A7D9CE33DC2C}.Release|x64.Build.0 = Release|x64
|
||||
{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}.Debug|x64.Build.0 = Debug|x64
|
||||
{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}.Release|Win32.Build.0 = Release|Win32
|
||||
{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}.Release|x64.ActiveCfg = Release|x64
|
||||
{D9DF7F2F-93B7-4810-B5CD-96F4F33C079B}.Release|x64.Build.0 = Release|x64
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}.Debug|x64.Build.0 = Debug|x64
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}.Release|Win32.Build.0 = Release|Win32
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}.Release|x64.ActiveCfg = Release|x64
|
||||
{4C8454FE-81D3-4CA3-9927-29BA96F03DAC}.Release|x64.Build.0 = Release|x64
|
||||
{203EC78A-0531-43F0-A636-285439BDE025}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{203EC78A-0531-43F0-A636-285439BDE025}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{203EC78A-0531-43F0-A636-285439BDE025}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{203EC78A-0531-43F0-A636-285439BDE025}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{203EC78A-0531-43F0-A636-285439BDE025}.Debug|x64.Build.0 = Debug|x64
|
||||
{203EC78A-0531-43F0-A636-285439BDE025}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{203EC78A-0531-43F0-A636-285439BDE025}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{203EC78A-0531-43F0-A636-285439BDE025}.Release|Win32.Build.0 = Release|Win32
|
||||
{203EC78A-0531-43F0-A636-285439BDE025}.Release|x64.ActiveCfg = Release|x64
|
||||
{203EC78A-0531-43F0-A636-285439BDE025}.Release|x64.Build.0 = Release|x64
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0}.Debug|x64.Build.0 = Debug|x64
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0}.Release|Win32.Build.0 = Release|Win32
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0}.Release|x64.ActiveCfg = Release|x64
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0}.Release|x64.Build.0 = Release|x64
|
||||
{DBA4088D-F6F9-4F8F-8820-082A4765C16C}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{DBA4088D-F6F9-4F8F-8820-082A4765C16C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DBA4088D-F6F9-4F8F-8820-082A4765C16C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DBA4088D-F6F9-4F8F-8820-082A4765C16C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{DBA4088D-F6F9-4F8F-8820-082A4765C16C}.Debug|x64.Build.0 = Debug|x64
|
||||
{DBA4088D-F6F9-4F8F-8820-082A4765C16C}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{DBA4088D-F6F9-4F8F-8820-082A4765C16C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DBA4088D-F6F9-4F8F-8820-082A4765C16C}.Release|Win32.Build.0 = Release|Win32
|
||||
{DBA4088D-F6F9-4F8F-8820-082A4765C16C}.Release|x64.ActiveCfg = Release|x64
|
||||
{DBA4088D-F6F9-4F8F-8820-082A4765C16C}.Release|x64.Build.0 = Release|x64
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C}.Debug|x64.Build.0 = Debug|x64
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C}.Release|Win32.Build.0 = Release|Win32
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C}.Release|x64.ActiveCfg = Release|x64
|
||||
{C2B04507-2521-4801-BF0D-5FD79D6D518C}.Release|x64.Build.0 = Release|x64
|
||||
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Debug|x64.Build.0 = Debug|x64
|
||||
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Release|Win32.Build.0 = Release|Win32
|
||||
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Release|x64.ActiveCfg = Release|x64
|
||||
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Release|x64.Build.0 = Release|x64
|
||||
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Debug|x64.Build.0 = Debug|x64
|
||||
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Release|Win32.Build.0 = Release|Win32
|
||||
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Release|x64.ActiveCfg = Release|x64
|
||||
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Release|x64.Build.0 = Release|x64
|
||||
{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}.Debug|x64.Build.0 = Debug|x64
|
||||
{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}.Release|Win32.Build.0 = Release|Win32
|
||||
{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}.Release|x64.ActiveCfg = Release|x64
|
||||
{62D4B15D-7A90-4ECB-BA19-5E021D6A21BC}.Release|x64.Build.0 = Release|x64
|
||||
{9D4211F7-2C77-439C-82F0-30A4E43BA569}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{9D4211F7-2C77-439C-82F0-30A4E43BA569}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9D4211F7-2C77-439C-82F0-30A4E43BA569}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9D4211F7-2C77-439C-82F0-30A4E43BA569}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9D4211F7-2C77-439C-82F0-30A4E43BA569}.Debug|x64.Build.0 = Debug|x64
|
||||
{9D4211F7-2C77-439C-82F0-30A4E43BA569}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{9D4211F7-2C77-439C-82F0-30A4E43BA569}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9D4211F7-2C77-439C-82F0-30A4E43BA569}.Release|Win32.Build.0 = Release|Win32
|
||||
{9D4211F7-2C77-439C-82F0-30A4E43BA569}.Release|x64.ActiveCfg = Release|x64
|
||||
{9D4211F7-2C77-439C-82F0-30A4E43BA569}.Release|x64.Build.0 = Release|x64
|
||||
{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}.Debug|x64.Build.0 = Debug|x64
|
||||
{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}.Release|Win32.Build.0 = Release|Win32
|
||||
{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}.Release|x64.ActiveCfg = Release|x64
|
||||
{691EE0C0-DC57-4A48-8AEE-8ED75EB3A057}.Release|x64.Build.0 = Release|x64
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Debug|x64.Build.0 = Debug|x64
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Release|Win32.Build.0 = Release|Win32
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Release|x64.ActiveCfg = Release|x64
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Release|x64.Build.0 = Release|x64
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Debug|x64.Build.0 = Debug|x64
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Release|Win32.Build.0 = Release|Win32
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Release|x64.ActiveCfg = Release|x64
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Release|x64.Build.0 = Release|x64
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Debug|x64.Build.0 = Debug|x64
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Release|Win32.Build.0 = Release|Win32
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Release|x64.ActiveCfg = Release|x64
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Release|x64.Build.0 = Release|x64
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Debug|x64.Build.0 = Debug|x64
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Release|ARM.Build.0 = Release|ARM
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Release|Win32.Build.0 = Release|Win32
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Release|x64.ActiveCfg = Release|x64
|
||||
{B1D53358-37BD-48BC-B27C-68BAF1E78508}.Release|x64.Build.0 = Release|x64
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Debug|x64.Build.0 = Debug|x64
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Release|ARM.Build.0 = Release|ARM
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Release|Win32.Build.0 = Release|Win32
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Release|x64.ActiveCfg = Release|x64
|
||||
{6786C051-383B-47E0-9E82-B8B994E06A25}.Release|x64.Build.0 = Release|x64
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Debug|x64.Build.0 = Debug|x64
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Release|ARM.Build.0 = Release|ARM
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Release|Win32.Build.0 = Release|Win32
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Release|x64.ActiveCfg = Release|x64
|
||||
{C10CF34B-3F79-430E-AD38-5A32DC0589C2}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A714726C-FE2D-466C-95F3-06C5C4EAE54F}
|
||||
EndGlobalSection
|
||||
GlobalSection(SubversionScc) = preSolution
|
||||
Svn-Managed = True
|
||||
Manager = AnkhSVN - Subversion Support for Visual Studio
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ set ICUFAILCNT=0
|
|||
@echo ==== %THT% =========================================================================
|
||||
%ICUINFO_CMD% %ICUINFO_OPTS%
|
||||
|
||||
@IF NOT ERRORLEVEL 1 GOTO OK_%THT%
|
||||
@IF %ERRORLEVEL% EQU 0 GOTO OK_%THT%
|
||||
@set ICUFAILED=%ICUFAILED% %THT%
|
||||
@set ICUFAILCNT=1
|
||||
:OK_icuinfo
|
||||
|
|
@ -63,7 +63,7 @@ set ICUFAILCNT=0
|
|||
@cd %ICU_ICUDIR%\source\test\intltest
|
||||
%INTLTEST_CMD% %INTLTEST_OPTS%
|
||||
|
||||
@IF NOT ERRORLEVEL 1 GOTO OK_%THT%
|
||||
@IF %ERRORLEVEL% EQU 0 GOTO OK_%THT%
|
||||
@set ICUFAILED=%ICUFAILED% %THT%
|
||||
@set ICUFAILCNT=1
|
||||
:OK_intltest
|
||||
|
|
@ -74,7 +74,7 @@ set ICUFAILCNT=0
|
|||
@cd %ICU_ICUDIR%\source\test\iotest
|
||||
%IOTEST_CMD% %IOTEST_OPTS%
|
||||
|
||||
@IF NOT ERRORLEVEL 1 GOTO OK_%THT%
|
||||
@IF %ERRORLEVEL% EQU 0 GOTO OK_%THT%
|
||||
@set ICUFAILED=%ICUFAILED% %THT%
|
||||
@set ICUFAILCNT=1
|
||||
:OK_IOTEST
|
||||
|
|
@ -85,7 +85,7 @@ set ICUFAILCNT=0
|
|||
@cd %ICU_ICUDIR%\source\test\cintltst
|
||||
%CINTLTST_CMD% %CINTLTST_OPTS%
|
||||
|
||||
@IF NOT ERRORLEVEL 1 GOTO OK_%THT%
|
||||
@IF %ERRORLEVEL% EQU 0 GOTO OK_%THT%
|
||||
@set ICUFAILED=%ICUFAILED% %THT%
|
||||
@set ICUFAILCNT=1
|
||||
:OK_cintltst
|
||||
|
|
@ -97,7 +97,7 @@ set ICUFAILCNT=0
|
|||
@REM @cd %ICU_ICUDIR%\source\test\letest
|
||||
@REM %LETST_CMD% %LETEST_OPTS%
|
||||
|
||||
@REM @IF NOT ERRORLEVEL 1 GOTO OK_%THT%
|
||||
@REM @IF %ERRORLEVEL% EQU 0 GOTO OK_%THT%
|
||||
@REM @set ICUFAILED=%ICUFAILED% %THT%
|
||||
@REM @set ICUFAILCNT=1
|
||||
@REM :OK_letest
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ LIBS = $(LIBICUDT) $(DEFAULT_LIBS)
|
|||
|
||||
OBJECTS = errorcode.o putil.o umath.o utypes.o uinvchar.o umutex.o ucln_cmn.o \
|
||||
uinit.o uobject.o cmemory.o charstr.o cstr.o \
|
||||
udata.o ucmndata.o udatamem.o umapfile.o udataswp.o ucol_swp.o utrace.o \
|
||||
udata.o ucmndata.o udatamem.o umapfile.o udataswp.o utrie_swap.o ucol_swp.o utrace.o \
|
||||
uhash.o uhash_us.o uenum.o ustrenum.o uvector.o ustack.o uvectr32.o uvectr64.o \
|
||||
ucnv.o ucnv_bld.o ucnv_cnv.o ucnv_io.o ucnv_cb.o ucnv_err.o ucnvlat1.o \
|
||||
ucnv_u7.o ucnv_u8.o ucnv_u16.o ucnv_u32.o ucnvscsu.o ucnvbocu.o \
|
||||
|
|
@ -89,28 +89,32 @@ ucnv_ext.o ucnvmbcs.o ucnv2022.o ucnvhz.o ucnv_lmb.o ucnvisci.o ucnvdisp.o ucnv_
|
|||
resource.o uresbund.o ures_cnv.o uresdata.o resbund.o resbund_cnv.o \
|
||||
ucurr.o \
|
||||
messagepattern.o ucat.o locmap.o uloc.o locid.o locutil.o locavailable.o locdispnames.o locdspnm.o loclikely.o locresdata.o \
|
||||
bytestream.o stringpiece.o \
|
||||
bytestream.o stringpiece.o bytesinkutil.o \
|
||||
stringtriebuilder.o bytestriebuilder.o \
|
||||
bytestrie.o bytestrieiterator.o \
|
||||
ucharstrie.o ucharstriebuilder.o ucharstrieiterator.o \
|
||||
dictionarydata.o \
|
||||
edits.o \
|
||||
appendable.o ustr_cnv.o unistr_cnv.o unistr.o unistr_case.o unistr_props.o \
|
||||
utf_impl.o ustring.o ustrcase.o ucasemap.o ucasemap_titlecase_brkiter.o cstring.o ustrfmt.o ustrtrns.o ustr_wcs.o utext.o \
|
||||
unistr_case_locale.o ustrcase_locale.o unistr_titlecase_brkiter.o ustr_titlecase_brkiter.o \
|
||||
normalizer2impl.o normalizer2.o filterednormalizer2.o normlzr.o unorm.o unormcmp.o loadednormalizer2impl.o \
|
||||
chariter.o schriter.o uchriter.o uiter.o \
|
||||
patternprops.o uchar.o uprops.o ucase.o propname.o ubidi_props.o ubidi.o ubidiwrt.o ubidiln.o ushape.o \
|
||||
patternprops.o uchar.o uprops.o ucase.o propname.o ubidi_props.o characterproperties.o \
|
||||
ubidi.o ubidiwrt.o ubidiln.o ushape.o \
|
||||
uscript.o uscript_props.o usc_impl.o unames.o \
|
||||
utrie.o utrie2.o utrie2_builder.o bmpset.o unisetspan.o uset_props.o uniset_props.o uniset_closure.o uset.o uniset.o usetiter.o ruleiter.o caniter.o unifilt.o unifunct.o \
|
||||
utrie.o utrie2.o utrie2_builder.o ucptrie.o umutablecptrie.o \
|
||||
bmpset.o unisetspan.o uset_props.o uniset_props.o uniset_closure.o uset.o uniset.o usetiter.o ruleiter.o caniter.o unifilt.o unifunct.o \
|
||||
uarrsort.o brkiter.o ubrk.o brkeng.o dictbe.o filteredbrk.o \
|
||||
rbbi.o rbbidata.o rbbinode.o rbbirb.o rbbiscan.o rbbisetb.o rbbistbl.o rbbitblb.o \
|
||||
rbbi.o rbbidata.o rbbinode.o rbbirb.o rbbiscan.o rbbisetb.o rbbistbl.o rbbitblb.o rbbi_cache.o \
|
||||
serv.o servnotf.o servls.o servlk.o servlkf.o servrbf.o servslkf.o \
|
||||
uidna.o usprep.o uts46.o punycode.o \
|
||||
util.o util_props.o parsepos.o locbased.o cwchar.o wintz.o dtintrv.o ucnvsel.o propsvec.o \
|
||||
ulist.o uloc_tag.o icudataver.o icuplug.o listformatter.o ulistformatter.o \
|
||||
ulist.o uloc_tag.o icudataver.o icuplug.o \
|
||||
sharedobject.o simpleformatter.o unifiedcache.o uloc_keytype.o \
|
||||
ubiditransform.o \
|
||||
pluralmap.o
|
||||
pluralmap.o \
|
||||
static_unicode_sets.o
|
||||
|
||||
## Header files to install
|
||||
HEADERS = $(srcdir)/unicode/*.h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* 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(asciiBytes, 0, sizeof(asciiBytes));
|
||||
uprv_memset(latin1Contains, 0, sizeof(latin1Contains));
|
||||
uprv_memset(table7FF, 0, sizeof(table7FF));
|
||||
uprv_memset(bmpBlockBits, 0, sizeof(bmpBlockBits));
|
||||
|
||||
|
|
@ -45,14 +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]);
|
||||
|
||||
initBits();
|
||||
overrideIllegal();
|
||||
}
|
||||
|
||||
BMPSet::BMPSet(const BMPSet &otherBMPSet, const int32_t *newParentList, int32_t newParentListLength) :
|
||||
containsFFFD(otherBMPSet.containsFFFD),
|
||||
list(newParentList), listLength(newParentListLength) {
|
||||
uprv_memcpy(asciiBytes, otherBMPSet.asciiBytes, sizeof(asciiBytes));
|
||||
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));
|
||||
|
|
@ -98,9 +100,9 @@ static void set32x64Bits(uint32_t table[64], int32_t start, int32_t limit) {
|
|||
++lead;
|
||||
}
|
||||
if(lead<limitLead) {
|
||||
bits=~((1<<lead)-1);
|
||||
bits=~(((unsigned)1<<lead)-1);
|
||||
if(limitLead<0x20) {
|
||||
bits&=(1<<limitLead)-1;
|
||||
bits&=((unsigned)1<<limitLead)-1;
|
||||
}
|
||||
for(trail=0; trail<64; ++trail) {
|
||||
table[trail]|=bits;
|
||||
|
|
@ -120,7 +122,7 @@ void BMPSet::initBits() {
|
|||
UChar32 start, limit;
|
||||
int32_t listIndex=0;
|
||||
|
||||
// Set asciiBytes[].
|
||||
// Set latin1Contains[].
|
||||
do {
|
||||
start=list[listIndex++];
|
||||
if(listIndex<listLength) {
|
||||
|
|
@ -128,13 +130,30 @@ void BMPSet::initBits() {
|
|||
} else {
|
||||
limit=0x110000;
|
||||
}
|
||||
if(start>=0x80) {
|
||||
if(start>=0x100) {
|
||||
break;
|
||||
}
|
||||
do {
|
||||
asciiBytes[start++]=1;
|
||||
} while(start<limit && start<0x80);
|
||||
} while(limit<=0x80);
|
||||
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) {
|
||||
|
|
@ -204,19 +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().
|
||||
* (asciiBytes[] trail bytes, 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(containsSlow(0xfffd, list4kStarts[0xf], list4kStarts[0x10])) {
|
||||
// contains(FFFD)==TRUE
|
||||
for(i=0x80; i<0xc0; ++i) {
|
||||
asciiBytes[i]=1;
|
||||
}
|
||||
|
||||
if(containsFFFD) {
|
||||
bits=3; // Lead bytes 0xC0 and 0xC1.
|
||||
for(i=0; i<64; ++i) {
|
||||
table7FF[i]|=bits;
|
||||
|
|
@ -227,14 +241,13 @@ void BMPSet::overrideIllegal() {
|
|||
bmpBlockBits[i]|=bits;
|
||||
}
|
||||
|
||||
mask=~(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 {
|
||||
// contains(FFFD)==FALSE
|
||||
mask=~(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;
|
||||
}
|
||||
|
|
@ -277,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<=0x7f) {
|
||||
return (UBool)asciiBytes[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)) {
|
||||
|
|
@ -314,8 +327,8 @@ BMPSet::span(const UChar *s, const UChar *limit, USetSpanCondition spanCondition
|
|||
// span
|
||||
do {
|
||||
c=*s;
|
||||
if(c<=0x7f) {
|
||||
if(!asciiBytes[c]) {
|
||||
if(c<=0xff) {
|
||||
if(!latin1Contains[c]) {
|
||||
break;
|
||||
}
|
||||
} else if(c<=0x7ff) {
|
||||
|
|
@ -354,8 +367,8 @@ BMPSet::span(const UChar *s, const UChar *limit, USetSpanCondition spanCondition
|
|||
// span not
|
||||
do {
|
||||
c=*s;
|
||||
if(c<=0x7f) {
|
||||
if(asciiBytes[c]) {
|
||||
if(c<=0xff) {
|
||||
if(latin1Contains[c]) {
|
||||
break;
|
||||
}
|
||||
} else if(c<=0x7ff) {
|
||||
|
|
@ -403,8 +416,8 @@ BMPSet::spanBack(const UChar *s, const UChar *limit, USetSpanCondition spanCondi
|
|||
// span
|
||||
for(;;) {
|
||||
c=*(--limit);
|
||||
if(c<=0x7f) {
|
||||
if(!asciiBytes[c]) {
|
||||
if(c<=0xff) {
|
||||
if(!latin1Contains[c]) {
|
||||
break;
|
||||
}
|
||||
} else if(c<=0x7ff) {
|
||||
|
|
@ -446,8 +459,8 @@ BMPSet::spanBack(const UChar *s, const UChar *limit, USetSpanCondition spanCondi
|
|||
// span not
|
||||
for(;;) {
|
||||
c=*(--limit);
|
||||
if(c<=0x7f) {
|
||||
if(asciiBytes[c]) {
|
||||
if(c<=0xff) {
|
||||
if(latin1Contains[c]) {
|
||||
break;
|
||||
}
|
||||
} else if(c<=0x7ff) {
|
||||
|
|
@ -497,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((int8_t)b>=0) {
|
||||
if(U8_IS_SINGLE(b)) {
|
||||
// Initial all-ASCII span.
|
||||
if(spanCondition) {
|
||||
do {
|
||||
if(!asciiBytes[b] || ++s==limit) {
|
||||
if(!latin1Contains[b] || ++s==limit) {
|
||||
return s;
|
||||
}
|
||||
b=*s;
|
||||
} while((int8_t)b>=0);
|
||||
} while(U8_IS_SINGLE(b));
|
||||
} else {
|
||||
do {
|
||||
if(asciiBytes[b] || ++s==limit) {
|
||||
if(latin1Contains[b] || ++s==limit) {
|
||||
return s;
|
||||
}
|
||||
b=*s;
|
||||
} while((int8_t)b>=0);
|
||||
} while(U8_IS_SINGLE(b));
|
||||
}
|
||||
length=(int32_t)(limit-s);
|
||||
}
|
||||
|
|
@ -540,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(asciiBytes[0x80]!=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(asciiBytes[0x80]!=spanCondition) {
|
||||
if(containsFFFD!=spanCondition) {
|
||||
limit0=limit;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// lead byte with no trail bytes
|
||||
--limit;
|
||||
if(asciiBytes[0x80]!=spanCondition) {
|
||||
if(containsFFFD!=spanCondition) {
|
||||
limit0=limit;
|
||||
}
|
||||
}
|
||||
|
|
@ -563,26 +576,26 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi
|
|||
|
||||
while(s<limit) {
|
||||
b=*s;
|
||||
if(b<0xc0) {
|
||||
// ASCII; or trail bytes with the result of contains(FFFD).
|
||||
if(U8_IS_SINGLE(b)) {
|
||||
// ASCII
|
||||
if(spanCondition) {
|
||||
do {
|
||||
if(!asciiBytes[b]) {
|
||||
if(!latin1Contains[b]) {
|
||||
return s;
|
||||
} else if(++s==limit) {
|
||||
return limit0;
|
||||
}
|
||||
b=*s;
|
||||
} while(b<0xc0);
|
||||
} while(U8_IS_SINGLE(b));
|
||||
} else {
|
||||
do {
|
||||
if(asciiBytes[b]) {
|
||||
if(latin1Contains[b]) {
|
||||
return s;
|
||||
} else if(++s==limit) {
|
||||
return limit0;
|
||||
}
|
||||
b=*s;
|
||||
} while(b<0xc0);
|
||||
} while(U8_IS_SINGLE(b));
|
||||
}
|
||||
}
|
||||
++s; // Advance past the lead byte.
|
||||
|
|
@ -619,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]) :
|
||||
asciiBytes[0x80]
|
||||
containsFFFD
|
||||
) != spanCondition
|
||||
) {
|
||||
return s-1;
|
||||
|
|
@ -627,8 +640,9 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi
|
|||
s+=3;
|
||||
continue;
|
||||
}
|
||||
} else /* 0xc0<=b<0xe0 */ {
|
||||
} else {
|
||||
if( /* handle U+0000..U+07FF inline */
|
||||
b>=0xc0 &&
|
||||
(t1=(uint8_t)(*s-0x80)) <= 0x3f
|
||||
) {
|
||||
if((USetSpanCondition)((table7FF[t1]&((uint32_t)1<<(b&0x1f)))!=0) != spanCondition) {
|
||||
|
|
@ -642,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(asciiBytes[0x80]!=spanCondition) {
|
||||
if(containsFFFD!=spanCondition) {
|
||||
return s-1;
|
||||
}
|
||||
}
|
||||
|
|
@ -667,26 +681,26 @@ BMPSet::spanBackUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCon
|
|||
|
||||
do {
|
||||
b=s[--length];
|
||||
if((int8_t)b>=0) {
|
||||
if(U8_IS_SINGLE(b)) {
|
||||
// ASCII sub-span
|
||||
if(spanCondition) {
|
||||
do {
|
||||
if(!asciiBytes[b]) {
|
||||
if(!latin1Contains[b]) {
|
||||
return length+1;
|
||||
} else if(length==0) {
|
||||
return 0;
|
||||
}
|
||||
b=s[--length];
|
||||
} while((int8_t)b>=0);
|
||||
} while(U8_IS_SINGLE(b));
|
||||
} else {
|
||||
do {
|
||||
if(asciiBytes[b]) {
|
||||
if(latin1Contains[b]) {
|
||||
return length+1;
|
||||
} else if(length==0) {
|
||||
return 0;
|
||||
}
|
||||
b=s[--length];
|
||||
} while((int8_t)b>=0);
|
||||
} while(U8_IS_SINGLE(b));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -28,11 +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.
|
||||
*
|
||||
* ASCII: 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: Call contains() on the parent set.
|
||||
* Supplementary characters: Binary search over
|
||||
* the supplementary part of the parent set's inversion list.
|
||||
*/
|
||||
class BMPSet : public UMemory {
|
||||
public:
|
||||
|
|
@ -96,12 +97,12 @@ private:
|
|||
inline UBool containsSlow(UChar32 c, int32_t lo, int32_t hi) const;
|
||||
|
||||
/*
|
||||
* One byte per ASCII character, or trail byte in lead position.
|
||||
* 0 or 1 for ASCII characters.
|
||||
* The value for trail bytes is the result of contains(FFFD)
|
||||
* for faster validity checking at runtime.
|
||||
* One byte 0 or 1 per Latin-1 character.
|
||||
*/
|
||||
UBool asciiBytes[0xc0];
|
||||
UBool latin1Contains[0x100];
|
||||
|
||||
/* TRUE if contains(U+FFFD). */
|
||||
UBool containsFFFD;
|
||||
|
||||
/*
|
||||
* One bit per code point from U+0000..U+07FF.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,6 @@
|
|||
|
||||
#if !UCONFIG_NO_BREAK_ITERATION
|
||||
|
||||
#include "brkeng.h"
|
||||
#include "cmemory.h"
|
||||
#include "dictbe.h"
|
||||
#include "unicode/uchar.h"
|
||||
#include "unicode/uniset.h"
|
||||
#include "unicode/chariter.h"
|
||||
|
|
@ -24,6 +21,10 @@
|
|||
#include "unicode/uscript.h"
|
||||
#include "unicode/ucharstrie.h"
|
||||
#include "unicode/bytestrie.h"
|
||||
|
||||
#include "brkeng.h"
|
||||
#include "cmemory.h"
|
||||
#include "dictbe.h"
|
||||
#include "charstr.h"
|
||||
#include "dictionarydata.h"
|
||||
#include "mutex.h"
|
||||
|
|
@ -58,66 +59,47 @@ LanguageBreakFactory::~LanguageBreakFactory() {
|
|||
******************************************************************
|
||||
*/
|
||||
|
||||
UnhandledEngine::UnhandledEngine(UErrorCode &/*status*/) {
|
||||
for (int32_t i = 0; i < UPRV_LENGTHOF(fHandled); ++i) {
|
||||
fHandled[i] = 0;
|
||||
}
|
||||
UnhandledEngine::UnhandledEngine(UErrorCode &status) : fHandled(nullptr) {
|
||||
(void)status;
|
||||
}
|
||||
|
||||
UnhandledEngine::~UnhandledEngine() {
|
||||
for (int32_t i = 0; i < UPRV_LENGTHOF(fHandled); ++i) {
|
||||
if (fHandled[i] != 0) {
|
||||
delete fHandled[i];
|
||||
}
|
||||
}
|
||||
delete fHandled;
|
||||
fHandled = nullptr;
|
||||
}
|
||||
|
||||
UBool
|
||||
UnhandledEngine::handles(UChar32 c, int32_t breakType) const {
|
||||
return (breakType >= 0 && breakType < UPRV_LENGTHOF(fHandled)
|
||||
&& fHandled[breakType] != 0 && fHandled[breakType]->contains(c));
|
||||
UnhandledEngine::handles(UChar32 c) const {
|
||||
return fHandled && fHandled->contains(c);
|
||||
}
|
||||
|
||||
int32_t
|
||||
UnhandledEngine::findBreaks( UText *text,
|
||||
int32_t startPos,
|
||||
int32_t endPos,
|
||||
UBool reverse,
|
||||
int32_t breakType,
|
||||
UStack &/*foundBreaks*/ ) const {
|
||||
if (breakType >= 0 && breakType < UPRV_LENGTHOF(fHandled)) {
|
||||
UChar32 c = utext_current32(text);
|
||||
if (reverse) {
|
||||
while((int32_t)utext_getNativeIndex(text) > startPos && fHandled[breakType]->contains(c)) {
|
||||
c = utext_previous32(text);
|
||||
}
|
||||
}
|
||||
else {
|
||||
while((int32_t)utext_getNativeIndex(text) < endPos && fHandled[breakType]->contains(c)) {
|
||||
utext_next32(text); // TODO: recast loop to work with post-increment operations.
|
||||
c = utext_current32(text);
|
||||
}
|
||||
}
|
||||
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, int32_t breakType) {
|
||||
if (breakType >= 0 && breakType < UPRV_LENGTHOF(fHandled)) {
|
||||
if (fHandled[breakType] == 0) {
|
||||
fHandled[breakType] = new UnicodeSet();
|
||||
if (fHandled[breakType] == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!fHandled[breakType]->contains(c)) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
// Apply the entire script of the character.
|
||||
int32_t script = u_getIntPropertyValue(c, UCHAR_SCRIPT);
|
||||
fHandled[breakType]->applyIntPropertyValue(UCHAR_SCRIPT, script, status);
|
||||
UnhandledEngine::handleCharacter(UChar32 c) {
|
||||
if (fHandled == nullptr) {
|
||||
fHandled = new UnicodeSet();
|
||||
if (fHandled == nullptr) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!fHandled->contains(c)) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
// Apply the entire script of the character.
|
||||
int32_t script = u_getIntPropertyValue(c, UCHAR_SCRIPT);
|
||||
fHandled->applyIntPropertyValue(UCHAR_SCRIPT, script, status);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -145,7 +127,7 @@ U_NAMESPACE_BEGIN
|
|||
static UMutex gBreakEngineMutex = U_MUTEX_INITIALIZER;
|
||||
|
||||
const LanguageBreakEngine *
|
||||
ICULanguageBreakFactory::getEngineFor(UChar32 c, int32_t breakType) {
|
||||
ICULanguageBreakFactory::getEngineFor(UChar32 c) {
|
||||
const LanguageBreakEngine *lbe = NULL;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
|
|
@ -163,14 +145,14 @@ ICULanguageBreakFactory::getEngineFor(UChar32 c, int32_t breakType) {
|
|||
int32_t i = fEngines->size();
|
||||
while (--i >= 0) {
|
||||
lbe = (const LanguageBreakEngine *)(fEngines->elementAt(i));
|
||||
if (lbe != NULL && lbe->handles(c, breakType)) {
|
||||
if (lbe != NULL && lbe->handles(c)) {
|
||||
return lbe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We didn't find an engine. Create one.
|
||||
lbe = loadEngineFor(c, breakType);
|
||||
lbe = loadEngineFor(c);
|
||||
if (lbe != NULL) {
|
||||
fEngines->push((void *)lbe, status);
|
||||
}
|
||||
|
|
@ -178,11 +160,11 @@ ICULanguageBreakFactory::getEngineFor(UChar32 c, int32_t breakType) {
|
|||
}
|
||||
|
||||
const LanguageBreakEngine *
|
||||
ICULanguageBreakFactory::loadEngineFor(UChar32 c, int32_t breakType) {
|
||||
ICULanguageBreakFactory::loadEngineFor(UChar32 c) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UScriptCode code = uscript_getScript(c, &status);
|
||||
if (U_SUCCESS(status)) {
|
||||
DictionaryMatcher *m = loadDictionaryMatcherFor(code, breakType);
|
||||
DictionaryMatcher *m = loadDictionaryMatcherFor(code);
|
||||
if (m != NULL) {
|
||||
const LanguageBreakEngine *engine = NULL;
|
||||
switch(code) {
|
||||
|
|
@ -243,7 +225,7 @@ ICULanguageBreakFactory::loadEngineFor(UChar32 c, int32_t breakType) {
|
|||
}
|
||||
|
||||
DictionaryMatcher *
|
||||
ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script, int32_t /* brkType */) {
|
||||
ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
// open root from brkitr tree.
|
||||
UResourceBundle *b = ures_open(U_ICUDATA_BRKITR, "", &status);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,6 +19,7 @@ U_NAMESPACE_BEGIN
|
|||
|
||||
class UnicodeSet;
|
||||
class UStack;
|
||||
class UVector32;
|
||||
class DictionaryMatcher;
|
||||
|
||||
/*******************************************************************
|
||||
|
|
@ -53,11 +54,10 @@ class LanguageBreakEngine : public UMemory {
|
|||
* a particular kind of break.</p>
|
||||
*
|
||||
* @param c A character which begins a run that the engine might handle
|
||||
* @param breakType The type of text break which the caller wants to determine
|
||||
* @return TRUE if this engine handles the particular character and break
|
||||
* type.
|
||||
*/
|
||||
virtual UBool handles(UChar32 c, int32_t breakType) const = 0;
|
||||
virtual UBool handles(UChar32 c) const = 0;
|
||||
|
||||
/**
|
||||
* <p>Find any breaks within a run in the supplied text.</p>
|
||||
|
|
@ -67,18 +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 reverse Whether the caller is looking for breaks in a reverse
|
||||
* direction.
|
||||
* @param breakType The type of break desired, or -1.
|
||||
* @param foundBreaks An allocated C array of the breaks found, if any
|
||||
* @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,
|
||||
UBool reverse,
|
||||
int32_t breakType,
|
||||
UStack &foundBreaks ) const = 0;
|
||||
UVector32 &foundBreaks ) const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -127,11 +122,9 @@ class LanguageBreakFactory : public UMemory {
|
|||
*
|
||||
* @param c A character that begins a run for which a LanguageBreakEngine is
|
||||
* sought.
|
||||
* @param breakType The kind of text break for which a LanguageBreakEngine is
|
||||
* sought.
|
||||
* @return A LanguageBreakEngine with the desired characteristics, or 0.
|
||||
*/
|
||||
virtual const LanguageBreakEngine *getEngineFor(UChar32 c, int32_t breakType) = 0;
|
||||
virtual const LanguageBreakEngine *getEngineFor(UChar32 c) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -154,11 +147,11 @@ class UnhandledEngine : public LanguageBreakEngine {
|
|||
private:
|
||||
|
||||
/**
|
||||
* The sets of characters handled, for each break type
|
||||
* The sets of characters handled.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
UnicodeSet *fHandled[4];
|
||||
UnicodeSet *fHandled;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -178,11 +171,10 @@ class UnhandledEngine : public LanguageBreakEngine {
|
|||
* a particular kind of break.</p>
|
||||
*
|
||||
* @param c A character which begins a run that the engine might handle
|
||||
* @param breakType The type of text break which the caller wants to determine
|
||||
* @return TRUE if this engine handles the particular character and break
|
||||
* type.
|
||||
*/
|
||||
virtual UBool handles(UChar32 c, int32_t breakType) const;
|
||||
virtual UBool handles(UChar32 c) const;
|
||||
|
||||
/**
|
||||
* <p>Find any breaks within a run in the supplied text.</p>
|
||||
|
|
@ -192,26 +184,20 @@ class UnhandledEngine : public LanguageBreakEngine {
|
|||
* is capable of handling.
|
||||
* @param startPos The start of the run within the supplied text.
|
||||
* @param endPos The end of the run within the supplied text.
|
||||
* @param reverse Whether the caller is looking for breaks in a reverse
|
||||
* direction.
|
||||
* @param breakType The type of break desired, or -1.
|
||||
* @param foundBreaks An allocated C array of the breaks found, if any
|
||||
* @return The number of breaks found.
|
||||
*/
|
||||
virtual int32_t findBreaks( UText *text,
|
||||
int32_t startPos,
|
||||
int32_t endPos,
|
||||
UBool reverse,
|
||||
int32_t breakType,
|
||||
UStack &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
|
||||
* @param breakType The type of text break for which the engine should handle c
|
||||
*/
|
||||
virtual void handleCharacter(UChar32 c, int32_t breakType);
|
||||
virtual void handleCharacter(UChar32 c);
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -255,11 +241,9 @@ class ICULanguageBreakFactory : public LanguageBreakFactory {
|
|||
*
|
||||
* @param c A character that begins a run for which a LanguageBreakEngine is
|
||||
* sought.
|
||||
* @param breakType The kind of text break for which a LanguageBreakEngine is
|
||||
* sought.
|
||||
* @return A LanguageBreakEngine with the desired characteristics, or 0.
|
||||
*/
|
||||
virtual const LanguageBreakEngine *getEngineFor(UChar32 c, int32_t breakType);
|
||||
virtual const LanguageBreakEngine *getEngineFor(UChar32 c);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
@ -268,21 +252,17 @@ protected:
|
|||
*
|
||||
* @param c A character that begins a run for which a LanguageBreakEngine is
|
||||
* sought.
|
||||
* @param breakType The kind of text break for which a LanguageBreakEngine is
|
||||
* sought.
|
||||
* @return A LanguageBreakEngine with the desired characteristics, or 0.
|
||||
*/
|
||||
virtual const LanguageBreakEngine *loadEngineFor(UChar32 c, int32_t breakType);
|
||||
virtual const LanguageBreakEngine *loadEngineFor(UChar32 c);
|
||||
|
||||
/**
|
||||
* <p>Create a DictionaryMatcher for the specified script and break type.</p>
|
||||
* @param script An ISO 15924 script code that identifies the dictionary to be
|
||||
* created.
|
||||
* @param breakType The kind of text break for which a dictionary is
|
||||
* sought.
|
||||
* @return A DictionaryMatcher with the desired characteristics, or NULL.
|
||||
*/
|
||||
virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script, int32_t breakType);
|
||||
virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script);
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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 @@ U_NAMESPACE_BEGIN
|
|||
// -------------------------------------
|
||||
|
||||
BreakIterator*
|
||||
BreakIterator::buildInstance(const Locale& loc, const char *type, int32_t kind, UErrorCode &status)
|
||||
BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &status)
|
||||
{
|
||||
char fnbuff[256];
|
||||
char ext[4]={'\0'};
|
||||
|
|
@ -121,7 +121,6 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, int32_t kind,
|
|||
U_LOCALE_BASED(locBased, *(BreakIterator*)result);
|
||||
locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status),
|
||||
actualLocale.data());
|
||||
result->setBreakType(kind);
|
||||
}
|
||||
|
||||
ures_close(b);
|
||||
|
|
@ -195,7 +194,7 @@ BreakIterator::getAvailableLocales(int32_t& count)
|
|||
|
||||
// ------------------------------------------
|
||||
//
|
||||
// Default constructor and destructor
|
||||
// Constructors, destructor and assignment operator
|
||||
//
|
||||
//-------------------------------------------
|
||||
|
||||
|
|
@ -204,6 +203,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()
|
||||
{
|
||||
}
|
||||
|
|
@ -265,7 +277,7 @@ ICUBreakIteratorService::~ICUBreakIteratorService() {}
|
|||
// defined in ucln_cmn.h
|
||||
U_NAMESPACE_END
|
||||
|
||||
static icu::UInitOnce gInitOnce;
|
||||
static icu::UInitOnce gInitOnceBrkiter;
|
||||
static icu::ICULocaleService* gService = NULL;
|
||||
|
||||
|
||||
|
|
@ -280,7 +292,7 @@ static UBool U_CALLCONV breakiterator_cleanup(void) {
|
|||
delete gService;
|
||||
gService = NULL;
|
||||
}
|
||||
gInitOnce.reset();
|
||||
gInitOnceBrkiter.reset();
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -296,7 +308,7 @@ initService(void) {
|
|||
static ICULocaleService*
|
||||
getService(void)
|
||||
{
|
||||
umtx_initOnce(gInitOnce, &initService);
|
||||
umtx_initOnce(gInitOnceBrkiter, &initService);
|
||||
return gService;
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +318,7 @@ getService(void)
|
|||
static inline UBool
|
||||
hasService(void)
|
||||
{
|
||||
return !gInitOnce.isReset() && getService() != NULL;
|
||||
return !gInitOnceBrkiter.isReset() && getService() != NULL;
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
|
|
@ -400,10 +412,10 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
|
|||
BreakIterator *result = NULL;
|
||||
switch (kind) {
|
||||
case UBRK_CHARACTER:
|
||||
result = BreakIterator::buildInstance(loc, "grapheme", kind, status);
|
||||
result = BreakIterator::buildInstance(loc, "grapheme", status);
|
||||
break;
|
||||
case UBRK_WORD:
|
||||
result = BreakIterator::buildInstance(loc, "word", kind, status);
|
||||
result = BreakIterator::buildInstance(loc, "word", status);
|
||||
break;
|
||||
case UBRK_LINE:
|
||||
uprv_strcpy(lbType, "line");
|
||||
|
|
@ -416,10 +428,10 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
|
|||
uprv_strcat(lbType, lbKeyValue);
|
||||
}
|
||||
}
|
||||
result = BreakIterator::buildInstance(loc, lbType, kind, status);
|
||||
result = BreakIterator::buildInstance(loc, lbType, status);
|
||||
break;
|
||||
case UBRK_SENTENCE:
|
||||
result = BreakIterator::buildInstance(loc, "sentence", kind, status);
|
||||
result = BreakIterator::buildInstance(loc, "sentence", status);
|
||||
#if !UCONFIG_NO_FILTERED_BREAK_ITERATION
|
||||
{
|
||||
char ssKeyValue[kKeyValueLenMax] = {0};
|
||||
|
|
@ -436,7 +448,7 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
|
|||
#endif
|
||||
break;
|
||||
case UBRK_TITLE:
|
||||
result = BreakIterator::buildInstance(loc, "title", kind, status);
|
||||
result = BreakIterator::buildInstance(loc, "title", status);
|
||||
break;
|
||||
default:
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
|
|
|
|||
161
intl/icu/source/common/bytesinkutil.cpp
Normal file
161
intl/icu/source/common/bytesinkutil.cpp
Normal file
|
|
@ -0,0 +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
|
||||
83
intl/icu/source/common/bytesinkutil.h
Normal file
83
intl/icu/source/common/bytesinkutil.h
Normal file
|
|
@ -0,0 +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 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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,6 +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;
|
||||
}
|
||||
appended_ += n;
|
||||
int32_t available = capacity_ - size_;
|
||||
if (n > available) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -339,7 +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=hash*37+ustr_hashCharsN(bytes, len);
|
||||
hash=static_cast<int32_t>(
|
||||
static_cast<uint32_t>(hash)*37u + static_cast<uint32_t>(ustr_hashCharsN(bytes, len)));
|
||||
}
|
||||
|
||||
UBool
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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.replace(i, U16_LENGTH(cp), NULL, 0), skipZeros, &subpermute, status);
|
||||
permute(subPermuteString.remove(i, U16_LENGTH(cp)), skipZeros, &subpermute, status);
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
// The upper replace 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())) {
|
||||
if((resultCount = result.count()) != 0) {
|
||||
finalResult = new UnicodeString[resultCount];
|
||||
if (finalResult == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
|
|
|
|||
381
intl/icu/source/common/characterproperties.cpp
Normal file
381
intl/icu/source/common/characterproperties.cpp
Normal file
|
|
@ -0,0 +1,381 @@
|
|||
// © 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;
|
||||
using icu::Normalizer2Factory;
|
||||
using icu::Normalizer2Impl;
|
||||
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;
|
||||
UInitOnce fInitOnce;
|
||||
};
|
||||
Inclusion gInclusions[NUM_INCLUSIONS]; // cached getInclusions()
|
||||
|
||||
UnicodeSet *sets[UCHAR_BINARY_LIMIT] = {};
|
||||
|
||||
UCPMap *maps[UCHAR_INT_LIMIT - UCHAR_INT_START] = {};
|
||||
|
||||
UMutex cpMutex = U_MUTEX_INITIALIZER;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// 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;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "charstr.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
|
|
@ -22,6 +23,18 @@
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) {
|
||||
if(U_SUCCESS(errorCode) && this!=&s && ensureCapacity(s.len+1, 0, errorCode)) {
|
||||
len=s.len;
|
||||
|
|
@ -66,7 +79,7 @@ CharString &CharString::append(const char *s, int32_t sLength, UErrorCode &error
|
|||
return *this;
|
||||
}
|
||||
if(sLength<0) {
|
||||
sLength=uprv_strlen(s);
|
||||
sLength= static_cast<int32_t>(uprv_strlen(s));
|
||||
}
|
||||
if(sLength>0) {
|
||||
if(s==(buffer.getAlias()+len)) {
|
||||
|
|
@ -113,15 +126,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) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return *this;
|
||||
}
|
||||
if (!uprv_isInvariantUnicodeString(s)) {
|
||||
if (!uprv_isInvariantUString(uchars, ucharsLen)) {
|
||||
errorCode = U_INVARIANT_CONVERSION_ERROR;
|
||||
return *this;
|
||||
}
|
||||
if(ensureCapacity(len+s.length()+1, 0, errorCode)) {
|
||||
len+=s.extract(0, 0x7fffffff, buffer.getAlias()+len, buffer.getCapacity()-len, US_INV);
|
||||
if(ensureCapacity(len+ucharsLen+1, 0, errorCode)) {
|
||||
u_UCharsToChars(uchars, buffer.getAlias()+len, ucharsLen);
|
||||
len += ucharsLen;
|
||||
buffer[len] = 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
|
|
@ -55,6 +55,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;
|
||||
|
||||
/**
|
||||
* Replaces this string's contents with the other string's contents.
|
||||
* CharString does not support the standard copy constructor nor
|
||||
|
|
@ -111,6 +123,7 @@ public:
|
|||
UErrorCode &errorCode);
|
||||
|
||||
CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode);
|
||||
CharString &appendInvariantChars(const UChar* uchars, int32_t ucharsLen, UErrorCode& errorCode);
|
||||
|
||||
/**
|
||||
* Appends a filename/path part, e.g., a directory name.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,30 +41,6 @@ static int n=0;
|
|||
static long b=0;
|
||||
#endif
|
||||
|
||||
#if U_DEBUG
|
||||
|
||||
static char gValidMemorySink = 0;
|
||||
|
||||
U_CAPI void uprv_checkValidMemory(const void *p, size_t n) {
|
||||
/*
|
||||
* Access the memory to ensure that it's all valid.
|
||||
* Load and save a computed value to try to ensure that the compiler
|
||||
* does not throw away the whole loop.
|
||||
* A thread analyzer might complain about un-mutexed access to gValidMemorySink
|
||||
* which is true but harmless because no one ever uses the value in gValidMemorySink.
|
||||
*/
|
||||
const char *s = (const char *)p;
|
||||
char c = gValidMemorySink;
|
||||
size_t i;
|
||||
U_ASSERT(p != NULL);
|
||||
for(i = 0; i < n; ++i) {
|
||||
c ^= s[i];
|
||||
}
|
||||
gValidMemorySink = c;
|
||||
}
|
||||
|
||||
#endif /* U_DEBUG */
|
||||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uprv_malloc(size_t s) {
|
||||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,31 +36,10 @@
|
|||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#if U_DEBUG
|
||||
|
||||
/*
|
||||
* The C++ standard requires that the source pointer for memcpy() & memmove()
|
||||
* is valid, not NULL, and not at the end of an allocated memory block.
|
||||
* In debug mode, we read one byte from the source point to verify that it's
|
||||
* a valid, readable pointer.
|
||||
*/
|
||||
|
||||
U_CAPI void uprv_checkValidMemory(const void *p, size_t n);
|
||||
|
||||
#define uprv_memcpy(dst, src, size) ( \
|
||||
uprv_checkValidMemory(src, 1), \
|
||||
U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size))
|
||||
#define uprv_memmove(dst, src, size) ( \
|
||||
uprv_checkValidMemory(src, 1), \
|
||||
U_STANDARD_CPP_NAMESPACE memmove(dst, src, size))
|
||||
|
||||
#else
|
||||
|
||||
#define uprv_memcpy(dst, src, size) U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size)
|
||||
#define uprv_memmove(dst, src, size) U_STANDARD_CPP_NAMESPACE memmove(dst, src, size)
|
||||
|
||||
#endif /* U_DEBUG */
|
||||
|
||||
/**
|
||||
* \def UPRV_LENGTHOF
|
||||
* Convenience macro to determine the length of a fixed array at compile-time.
|
||||
|
|
@ -162,7 +141,6 @@ public:
|
|||
* @param p simple pointer to an array of T items that is adopted
|
||||
*/
|
||||
explicit LocalMemory(T *p=NULL) : LocalPointerBase<T>(p) {}
|
||||
#if U_HAVE_RVALUE_REFERENCES
|
||||
/**
|
||||
* Move constructor, leaves src with isNull().
|
||||
* @param src source smart pointer
|
||||
|
|
@ -170,14 +148,12 @@ public:
|
|||
LocalMemory(LocalMemory<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
|
||||
src.ptr=NULL;
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* Destructor deletes the memory it owns.
|
||||
*/
|
||||
~LocalMemory() {
|
||||
uprv_free(LocalPointerBase<T>::ptr);
|
||||
}
|
||||
#if U_HAVE_RVALUE_REFERENCES
|
||||
/**
|
||||
* Move assignment operator, leaves src with isNull().
|
||||
* The behavior is undefined if *this and src are the same object.
|
||||
|
|
@ -187,7 +163,6 @@ public:
|
|||
LocalMemory<T> &operator=(LocalMemory<T> &&src) U_NOEXCEPT {
|
||||
return moveFrom(src);
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* Move assignment, leaves src with isNull().
|
||||
* The behavior is undefined if *this and src are the same object.
|
||||
|
|
@ -197,7 +172,7 @@ public:
|
|||
* @return *this
|
||||
*/
|
||||
LocalMemory<T> &moveFrom(LocalMemory<T> &src) U_NOEXCEPT {
|
||||
delete[] LocalPointerBase<T>::ptr;
|
||||
uprv_free(LocalPointerBase<T>::ptr);
|
||||
LocalPointerBase<T>::ptr=src.ptr;
|
||||
src.ptr=NULL;
|
||||
return *this;
|
||||
|
|
@ -304,6 +279,10 @@ 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.
|
||||
*/
|
||||
template<typename T, int32_t stackCapacity>
|
||||
class MaybeStackArray {
|
||||
|
|
@ -312,10 +291,26 @@ public:
|
|||
* 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); }
|
||||
};
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Returns the array capacity (number of T items).
|
||||
* @return array capacity
|
||||
|
|
@ -393,6 +388,11 @@ private:
|
|||
uprv_free(ptr);
|
||||
}
|
||||
}
|
||||
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;}
|
||||
|
|
@ -415,6 +415,34 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
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) {
|
||||
|
|
@ -464,9 +492,7 @@ inline T *MaybeStackArray<T, stackCapacity>::orphanOrClone(int32_t length, int32
|
|||
uprv_memcpy(p, ptr, (size_t)length*sizeof(T));
|
||||
}
|
||||
resultCapacity=length;
|
||||
ptr=stackArray;
|
||||
capacity=stackCapacity;
|
||||
needToRelease=FALSE;
|
||||
resetToStackArray();
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="bidi">
|
||||
|
|
@ -49,16 +49,16 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ubidi.c">
|
||||
<ClCompile Include="ubidi.cpp">
|
||||
<Filter>bidi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ubidi_props.c">
|
||||
<ClCompile Include="ubidi_props.cpp">
|
||||
<Filter>bidi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ubidiln.c">
|
||||
<ClCompile Include="ubidiln.cpp">
|
||||
<Filter>bidi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ubidiwrt.c">
|
||||
<ClCompile Include="ubidiwrt.cpp">
|
||||
<Filter>bidi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ushape.cpp">
|
||||
|
|
@ -97,6 +97,9 @@
|
|||
<ClCompile Include="rbbitblb.cpp">
|
||||
<Filter>break iteration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rbbi_cache.cpp">
|
||||
<Filter>break iteration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ubrk.cpp">
|
||||
<Filter>break iteration</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -106,22 +109,22 @@
|
|||
<ClCompile Include="pluralmap.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="propsvec.c">
|
||||
<ClCompile Include="propsvec.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uarrsort.c">
|
||||
<ClCompile Include="uarrsort.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uenum.c">
|
||||
<ClCompile Include="uenum.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uhash.c">
|
||||
<ClCompile Include="uhash.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uhash_us.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ulist.c">
|
||||
<ClCompile Include="ulist.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="unifiedcache.cpp">
|
||||
|
|
@ -136,6 +139,9 @@
|
|||
<ClCompile Include="utrie.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utrie_swap.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utrie2.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -154,31 +160,31 @@
|
|||
<ClCompile Include="errorcode.cpp">
|
||||
<Filter>configuration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="icudataver.c">
|
||||
<ClCompile Include="icudataver.cpp">
|
||||
<Filter>configuration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="locmap.c">
|
||||
<ClCompile Include="locmap.cpp">
|
||||
<Filter>configuration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="putil.cpp">
|
||||
<Filter>configuration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="umath.c">
|
||||
<ClCompile Include="umath.cpp">
|
||||
<Filter>configuration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="umutex.cpp">
|
||||
<Filter>configuration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utrace.c">
|
||||
<ClCompile Include="utrace.cpp">
|
||||
<Filter>configuration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utypes.c">
|
||||
<ClCompile Include="utypes.cpp">
|
||||
<Filter>configuration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wintz.c">
|
||||
<ClCompile Include="wintz.cpp">
|
||||
<Filter>configuration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv.c">
|
||||
<ClCompile Include="ucnv.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv2022.cpp">
|
||||
|
|
@ -187,13 +193,13 @@
|
|||
<ClCompile Include="ucnv_bld.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_cb.c">
|
||||
<ClCompile Include="ucnv_cb.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_cnv.c">
|
||||
<ClCompile Include="ucnv_cnv.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_err.c">
|
||||
<ClCompile Include="ucnv_err.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_ext.cpp">
|
||||
|
|
@ -202,49 +208,49 @@
|
|||
<ClCompile Include="ucnv_io.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_lmb.c">
|
||||
<ClCompile Include="ucnv_lmb.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_set.c">
|
||||
<ClCompile Include="ucnv_set.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_u16.c">
|
||||
<ClCompile Include="ucnv_u16.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_u32.c">
|
||||
<ClCompile Include="ucnv_u32.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_u7.c">
|
||||
<ClCompile Include="ucnv_u7.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_u8.c">
|
||||
<ClCompile Include="ucnv_u8.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnvbocu.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnvdisp.c">
|
||||
<ClCompile Include="ucnvdisp.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnvhz.c">
|
||||
<ClCompile Include="ucnvhz.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnvisci.c">
|
||||
<ClCompile Include="ucnvisci.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnvlat1.c">
|
||||
<ClCompile Include="ucnvlat1.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnvmbcs.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnvscsu.c">
|
||||
<ClCompile Include="ucnvscsu.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnvsel.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cmemory.c">
|
||||
<ClCompile Include="cmemory.cpp">
|
||||
<Filter>data & memory</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sharedobject.cpp">
|
||||
|
|
@ -253,22 +259,22 @@
|
|||
<ClCompile Include="ucln_cmn.cpp">
|
||||
<Filter>data & memory</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucmndata.c">
|
||||
<ClCompile Include="ucmndata.cpp">
|
||||
<Filter>data & memory</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="udata.cpp">
|
||||
<Filter>data & memory</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="udatamem.c">
|
||||
<ClCompile Include="udatamem.cpp">
|
||||
<Filter>data & memory</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="udataswp.c">
|
||||
<ClCompile Include="udataswp.cpp">
|
||||
<Filter>data & memory</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uinit.cpp">
|
||||
<Filter>data & memory</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="umapfile.c">
|
||||
<ClCompile Include="umapfile.cpp">
|
||||
<Filter>data & memory</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uobject.cpp">
|
||||
|
|
@ -289,7 +295,7 @@
|
|||
<ClCompile Include="ucurr.cpp">
|
||||
<Filter>formatting</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ustrfmt.c">
|
||||
<ClCompile Include="ustrfmt.cpp">
|
||||
<Filter>formatting</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="util.cpp">
|
||||
|
|
@ -334,16 +340,16 @@
|
|||
<ClCompile Include="resbund_cnv.cpp">
|
||||
<Filter>locales & resources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucat.c">
|
||||
<ClCompile Include="ucat.cpp">
|
||||
<Filter>locales & resources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uloc.cpp">
|
||||
<Filter>locales & resources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uloc_tag.c">
|
||||
<ClCompile Include="uloc_tag.cpp">
|
||||
<Filter>locales & resources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ures_cnv.c">
|
||||
<ClCompile Include="ures_cnv.cpp">
|
||||
<Filter>locales & resources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uresbund.cpp">
|
||||
|
|
@ -382,6 +388,9 @@
|
|||
<ClCompile Include="bmpset.cpp">
|
||||
<Filter>properties & sets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="characterproperties.cpp">
|
||||
<Filter>properties & sets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="propname.cpp">
|
||||
<Filter>properties & sets</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -391,7 +400,7 @@
|
|||
<ClCompile Include="ucase.cpp">
|
||||
<Filter>properties & sets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uchar.c">
|
||||
<ClCompile Include="uchar.cpp">
|
||||
<Filter>properties & sets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="unames.cpp">
|
||||
|
|
@ -418,10 +427,10 @@
|
|||
<ClCompile Include="uprops.cpp">
|
||||
<Filter>properties & sets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="usc_impl.c">
|
||||
<ClCompile Include="usc_impl.cpp">
|
||||
<Filter>properties & sets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uscript.c">
|
||||
<ClCompile Include="uscript.cpp">
|
||||
<Filter>properties & sets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uscript_props.cpp">
|
||||
|
|
@ -460,6 +469,9 @@
|
|||
<ClCompile Include="usprep.cpp">
|
||||
<Filter>sprep</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="bytesinkutil.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="bytestream.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -469,13 +481,16 @@
|
|||
<ClCompile Include="charstr.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cstring.c">
|
||||
<ClCompile Include="cstring.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cstr.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cwchar.c">
|
||||
<ClCompile Include="cwchar.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="edits.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="schriter.cpp">
|
||||
|
|
@ -493,7 +508,7 @@
|
|||
<ClCompile Include="uchriter.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uinvchar.c">
|
||||
<ClCompile Include="uinvchar.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="uiter.cpp">
|
||||
|
|
@ -541,7 +556,7 @@
|
|||
<ClCompile Include="utext.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utf_impl.c">
|
||||
<ClCompile Include="utf_impl.cpp">
|
||||
<Filter>strings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="bytestrie.cpp">
|
||||
|
|
@ -553,12 +568,6 @@
|
|||
<ClCompile Include="bytestriebuilder.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="listformatter.cpp">
|
||||
<Filter>formatting</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ulistformatter.cpp">
|
||||
<Filter>formatting</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="messagepattern.cpp">
|
||||
<Filter>formatting</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -568,7 +577,7 @@
|
|||
<ClCompile Include="dictionarydata.cpp">
|
||||
<Filter>break iteration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucnv_ct.c">
|
||||
<ClCompile Include="ucnv_ct.cpp">
|
||||
<Filter>conversion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucharstrie.cpp">
|
||||
|
|
@ -580,6 +589,12 @@
|
|||
<ClCompile Include="ucharstrieiterator.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ucptrie.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="umutablecptrie.cpp">
|
||||
<Filter>collections</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="patternprops.cpp">
|
||||
<Filter>properties & sets</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -595,9 +610,12 @@
|
|||
<ClCompile Include="icuplug.cpp">
|
||||
<Filter>registration</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ubiditransform.c">
|
||||
<ClCompile Include="ubiditransform.cpp">
|
||||
<Filter>bidi</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="static_unicode_sets.cpp">
|
||||
<Filter>formatting</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ubidi_props.h">
|
||||
|
|
@ -633,6 +651,9 @@
|
|||
<ClInclude Include="rbbitblb.h">
|
||||
<Filter>break iteration</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="rbbi_cache.h">
|
||||
<Filter>break iteration</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ubrkimpl.h">
|
||||
<Filter>break iteration</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -858,6 +879,9 @@
|
|||
<ClInclude Include="sprpimpl.h">
|
||||
<Filter>sprep</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="bytesinkutil.h">
|
||||
<Filter>strings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="charstr.h">
|
||||
<Filter>strings</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -870,6 +894,9 @@
|
|||
<ClInclude Include="cwchar.h">
|
||||
<Filter>strings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ucasemap_imp.h">
|
||||
<Filter>strings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="uinvchar.h">
|
||||
<Filter>strings</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -918,6 +945,9 @@
|
|||
<ClInclude Include="unicode\ubiditransform.h">
|
||||
<Filter>bidi</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="static_unicode_sets.h">
|
||||
<Filter>formatting</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="common.rc">
|
||||
|
|
@ -1096,9 +1126,18 @@
|
|||
<CustomBuild Include="unicode\bytestream.h">
|
||||
<Filter>strings</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\casemap.h">
|
||||
<Filter>strings</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\char16ptr.h">
|
||||
<Filter>strings</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\chariter.h">
|
||||
<Filter>strings</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\edits.h">
|
||||
<Filter>strings</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\rep.h">
|
||||
<Filter>strings</Filter>
|
||||
</CustomBuild>
|
||||
|
|
@ -1153,12 +1192,6 @@
|
|||
<CustomBuild Include="unicode\messagepattern.h">
|
||||
<Filter>formatting</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\listformatter.h">
|
||||
<Filter>formatting</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\ulistformatter.h">
|
||||
<Filter>formatting</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\appendable.h">
|
||||
<Filter>strings</Filter>
|
||||
</CustomBuild>
|
||||
|
|
@ -1171,6 +1204,12 @@
|
|||
<CustomBuild Include="unicode\ucharstriebuilder.h">
|
||||
<Filter>collections</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\ucptrie.h">
|
||||
<Filter>collections</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\umutablecptrie.h">
|
||||
<Filter>collections</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\enumset.h">
|
||||
<Filter>data & memory</Filter>
|
||||
</CustomBuild>
|
||||
|
|
@ -1180,5 +1219,8 @@
|
|||
<CustomBuild Include="unicode\stringtriebuilder.h">
|
||||
<Filter>collections</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="unicode\stringoptions.h">
|
||||
<Filter>strings</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
580
intl/icu/source/common/common_uwp.vcxproj
Normal file
580
intl/icu/source/common/common_uwp.vcxproj
Normal file
|
|
@ -0,0 +1,580 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!-- The following import will include the UWP configuration options for VS projects. -->
|
||||
<Import Project="..\allinone\Build.Windows.UWP.ProjectConfiguration.props" />
|
||||
<!-- The following import will include the library configuration options for VS projects. -->
|
||||
<Import Project="..\allinone\Build.Windows.Library.ProjectConfiguration.props" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C10CF34B-3F79-430E-AD38-5A32DC0589C2}</ProjectGuid>
|
||||
<Keyword>DynamicLibrary</Keyword>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\x86\ReleaseUWP\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\x86\ReleaseUWP\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\x86\DebugUWP\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\x86\DebugUWP\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\x64\ReleaseUWP\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\x64\ReleaseUWP\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\x64\DebugUWP\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\x64\DebugUWP\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">.\arm\ReleaseUWP\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">.\arm\ReleaseUWP\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">.\arm\DebugUWP\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">.\arm\DebugUWP\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)'=='Release'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)'=='Debug'">true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<!-- Options that are common to *all* configurations -->
|
||||
<Midl>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<!-- U_DISABLE_RENAMING -->
|
||||
<!-- U_HIDE_DRAFT_API & U_HIDE_DEPRECATED_API -->
|
||||
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;U_PLATFORM_USES_ONLY_WIN32_API=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>../common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TurnOffAssemblyGeneration>true</TurnOffAssemblyGeneration>
|
||||
<IgnoreSpecificDefaultLibraries>vccorlib.lib;msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<!-- Options that are common to all 'Release' configurations -->
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<AdditionalDependencies>vccorlib.lib;WindowsApp.lib;msvcrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<!-- Options that are common to all 'Debug' configurations -->
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>vccorlibd.lib;WindowsApp.lib;msvcrtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
|
||||
<!-- Options that are common to all 32-bit configurations -->
|
||||
<Midl>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
|
||||
<!-- Options that are common to all 64-bit configurations -->
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN64;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Platform)'=='ARM'">
|
||||
<!-- Options that are common to all ARM configurations -->
|
||||
<Midl>
|
||||
<TargetEnvironment>ARM</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>ARM;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineARM</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Options that are specific to a particular configuration -->
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\..\..\lib32uwp\icuuc.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderOutputFile>.\x86\ReleaseUWP/common.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\x86\ReleaseUWP/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\x86\ReleaseUWP/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\x86\ReleaseUWP/</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>..\..\bin32uwp\icuuc63.dll</OutputFile>
|
||||
<ProgramDatabaseFile>.\..\..\lib32uwp\icuuc.pdb</ProgramDatabaseFile>
|
||||
<ImportLibrary>..\..\lib32uwp\icuuc.lib</ImportLibrary>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\..\..\lib32uwp\icuucd.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderOutputFile>.\x86\DebugUWP/common.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\x86\DebugUWP/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\x86\DebugUWP/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\x86\DebugUWP/</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>..\..\bin32uwp\icuuc63d.dll</OutputFile>
|
||||
<ProgramDatabaseFile>.\..\..\lib32uwp\icuucd.pdb</ProgramDatabaseFile>
|
||||
<ImportLibrary>..\..\lib32uwp\icuucd.lib</ImportLibrary>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\..\..\lib64uwp\icuuc.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderOutputFile>.\x64\ReleaseUWP/common.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\x64\ReleaseUWP/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\x64\ReleaseUWP/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\x64\ReleaseUWP/</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>..\..\bin64uwp\icuuc63.dll</OutputFile>
|
||||
<ProgramDatabaseFile>.\..\..\lib64uwp\icuuc.pdb</ProgramDatabaseFile>
|
||||
<ImportLibrary>..\..\lib64uwp\icuuc.lib</ImportLibrary>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\..\..\lib64uwp\icuucd.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderOutputFile>.\x64\DebugUWP/common.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\x64\DebugUWP/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\x64\DebugUWP/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\x64\DebugUWP/</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>..\..\bin64uwp\icuuc63d.dll</OutputFile>
|
||||
<ProgramDatabaseFile>.\..\..\lib64uwp\icuucd.pdb</ProgramDatabaseFile>
|
||||
<ImportLibrary>..\..\lib64uwp\icuucd.lib</ImportLibrary>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\..\..\libARMuwp\icuuc.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderOutputFile>.\ARM\ReleaseUWP/common.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\ARM\ReleaseUWP/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\ARM\ReleaseUWP/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\ARM\ReleaseUWP/</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>..\..\binARMuwp\icuuc63.dll</OutputFile>
|
||||
<ProgramDatabaseFile>.\..\..\libARMuwp\icuuc.pdb</ProgramDatabaseFile>
|
||||
<ImportLibrary>..\..\libARMuwp\icuuc.lib</ImportLibrary>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<Midl>
|
||||
<TypeLibraryName>.\..\..\libARMuwp\icuucd.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderOutputFile>.\ARM\DebugUWP/common.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\ARM\DebugUWP/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\ARM\DebugUWP/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\ARM\DebugUWP/</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>..\..\binARMuwp\icuuc63d.dll</OutputFile>
|
||||
<ProgramDatabaseFile>.\..\..\libARMuwp\icuucd.pdb</ProgramDatabaseFile>
|
||||
<ImportLibrary>..\..\libARMuwp\icuucd.lib</ImportLibrary>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="edits.cpp" />
|
||||
<ClCompile Include="filteredbrk.cpp" />
|
||||
<ClCompile Include="ubidi.cpp" />
|
||||
<ClCompile Include="ubidi_props.cpp" />
|
||||
<ClCompile Include="ubiditransform.cpp" />
|
||||
<ClCompile Include="ubidiln.cpp" />
|
||||
<ClCompile Include="ubidiwrt.cpp" />
|
||||
<ClCompile Include="uloc_keytype.cpp" />
|
||||
<ClCompile Include="ushape.cpp" />
|
||||
<ClCompile Include="brkeng.cpp" />
|
||||
<ClCompile Include="brkiter.cpp" />
|
||||
<ClCompile Include="dictbe.cpp" />
|
||||
<ClCompile Include="pluralmap.cpp" />
|
||||
<ClCompile Include="rbbi.cpp" />
|
||||
<ClCompile Include="rbbidata.cpp" />
|
||||
<ClCompile Include="rbbinode.cpp" />
|
||||
<ClCompile Include="rbbirb.cpp" />
|
||||
<ClCompile Include="rbbiscan.cpp" />
|
||||
<ClCompile Include="rbbisetb.cpp" />
|
||||
<ClCompile Include="rbbistbl.cpp" />
|
||||
<ClCompile Include="rbbitblb.cpp" />
|
||||
<ClCompile Include="rbbi_cache.cpp" />
|
||||
<ClCompile Include="dictionarydata.cpp" />
|
||||
<ClCompile Include="ubrk.cpp" />
|
||||
<ClCompile Include="ucol_swp.cpp" />
|
||||
<ClCompile Include="propsvec.cpp" />
|
||||
<ClCompile Include="uarrsort.cpp" />
|
||||
<ClCompile Include="uenum.cpp" />
|
||||
<ClCompile Include="uhash.cpp" />
|
||||
<ClCompile Include="uhash_us.cpp" />
|
||||
<ClCompile Include="ulist.cpp" />
|
||||
<ClCompile Include="ustack.cpp" />
|
||||
<ClCompile Include="ustrenum.cpp" />
|
||||
<ClCompile Include="utrie.cpp" />
|
||||
<ClCompile Include="utrie_swap.cpp" />
|
||||
<ClCompile Include="utrie2.cpp" />
|
||||
<ClCompile Include="utrie2_builder.cpp" />
|
||||
<ClCompile Include="uvector.cpp" />
|
||||
<ClCompile Include="uvectr32.cpp" />
|
||||
<ClCompile Include="uvectr64.cpp" />
|
||||
<ClCompile Include="errorcode.cpp" />
|
||||
<ClCompile Include="icudataver.cpp" />
|
||||
<ClCompile Include="locmap.cpp" />
|
||||
<ClCompile Include="putil.cpp">
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="umath.cpp" />
|
||||
<ClCompile Include="umutex.cpp" />
|
||||
<ClCompile Include="utrace.cpp" />
|
||||
<ClCompile Include="utypes.cpp" />
|
||||
<ClCompile Include="wintz.cpp" />
|
||||
<ClCompile Include="ucnv.cpp" />
|
||||
<ClCompile Include="ucnv2022.cpp" />
|
||||
<ClCompile Include="ucnv_bld.cpp" />
|
||||
<ClCompile Include="ucnv_cb.cpp" />
|
||||
<ClCompile Include="ucnv_cnv.cpp" />
|
||||
<ClCompile Include="ucnv_ct.cpp" />
|
||||
<ClCompile Include="ucnv_err.cpp" />
|
||||
<ClCompile Include="ucnv_ext.cpp" />
|
||||
<ClCompile Include="ucnv_io.cpp" />
|
||||
<ClCompile Include="ucnv_lmb.cpp" />
|
||||
<ClCompile Include="ucnv_set.cpp" />
|
||||
<ClCompile Include="ucnv_u16.cpp" />
|
||||
<ClCompile Include="ucnv_u32.cpp" />
|
||||
<ClCompile Include="ucnv_u7.cpp" />
|
||||
<ClCompile Include="ucnv_u8.cpp" />
|
||||
<ClCompile Include="ucnvbocu.cpp" />
|
||||
<ClCompile Include="ucnvdisp.cpp" />
|
||||
<ClCompile Include="ucnvhz.cpp" />
|
||||
<ClCompile Include="ucnvisci.cpp" />
|
||||
<ClCompile Include="ucnvlat1.cpp" />
|
||||
<ClCompile Include="ucnvmbcs.cpp" />
|
||||
<ClCompile Include="ucnvscsu.cpp" />
|
||||
<ClCompile Include="ucnvsel.cpp" />
|
||||
<ClCompile Include="cmemory.cpp" />
|
||||
<ClCompile Include="ucln_cmn.cpp" />
|
||||
<ClCompile Include="ucmndata.cpp" />
|
||||
<ClCompile Include="udata.cpp" />
|
||||
<ClCompile Include="udatamem.cpp" />
|
||||
<ClCompile Include="udataswp.cpp" />
|
||||
<ClCompile Include="uinit.cpp" />
|
||||
<ClCompile Include="umapfile.cpp" />
|
||||
<ClCompile Include="uobject.cpp" />
|
||||
<ClCompile Include="dtintrv.cpp" />
|
||||
<ClCompile Include="parsepos.cpp" />
|
||||
<ClCompile Include="ustrfmt.cpp" />
|
||||
<ClCompile Include="util.cpp" />
|
||||
<ClCompile Include="util_props.cpp" />
|
||||
<ClCompile Include="punycode.cpp" />
|
||||
<ClCompile Include="uidna.cpp" />
|
||||
<ClCompile Include="uts46.cpp" />
|
||||
<ClCompile Include="locavailable.cpp" />
|
||||
<ClCompile Include="locbased.cpp" />
|
||||
<ClCompile Include="locdispnames.cpp" />
|
||||
<ClCompile Include="locdspnm.cpp" />
|
||||
<ClCompile Include="locid.cpp" />
|
||||
<ClCompile Include="loclikely.cpp" />
|
||||
<ClCompile Include="locresdata.cpp" />
|
||||
<ClCompile Include="locutil.cpp" />
|
||||
<ClCompile Include="resbund.cpp" />
|
||||
<ClCompile Include="resbund_cnv.cpp" />
|
||||
<ClCompile Include="ucat.cpp" />
|
||||
<ClCompile Include="uloc.cpp" />
|
||||
<ClCompile Include="uloc_tag.cpp" />
|
||||
<ClCompile Include="ures_cnv.cpp" />
|
||||
<ClCompile Include="uresbund.cpp" />
|
||||
<ClCompile Include="uresdata.cpp" />
|
||||
<ClCompile Include="resource.cpp" />
|
||||
<ClCompile Include="ucurr.cpp" />
|
||||
<ClCompile Include="caniter.cpp" />
|
||||
<ClCompile Include="filterednormalizer2.cpp" />
|
||||
<ClCompile Include="loadednormalizer2impl.cpp" />
|
||||
<ClCompile Include="normalizer2.cpp" />
|
||||
<ClCompile Include="normalizer2impl.cpp" />
|
||||
<ClCompile Include="normlzr.cpp" />
|
||||
<ClCompile Include="unorm.cpp" />
|
||||
<ClCompile Include="unormcmp.cpp" />
|
||||
<ClCompile Include="bmpset.cpp" />
|
||||
<ClCompile Include="patternprops.cpp" />
|
||||
<ClCompile Include="propname.cpp" />
|
||||
<ClCompile Include="ruleiter.cpp" />
|
||||
<ClCompile Include="ucase.cpp" />
|
||||
<ClCompile Include="uchar.cpp" />
|
||||
<ClCompile Include="characterproperties.cpp" />
|
||||
<ClCompile Include="unames.cpp" />
|
||||
<ClCompile Include="unifiedcache.cpp" />
|
||||
<ClCompile Include="unifilt.cpp" />
|
||||
<ClCompile Include="unifunct.cpp" />
|
||||
<ClCompile Include="uniset.cpp" />
|
||||
<ClCompile Include="uniset_closure.cpp" />
|
||||
<ClCompile Include="uniset_props.cpp" />
|
||||
<ClCompile Include="unisetspan.cpp" />
|
||||
<ClCompile Include="uprops.cpp" />
|
||||
<ClCompile Include="usc_impl.cpp" />
|
||||
<ClCompile Include="uscript.cpp" />
|
||||
<ClCompile Include="uscript_props.cpp" />
|
||||
<ClCompile Include="uset.cpp" />
|
||||
<ClCompile Include="uset_props.cpp" />
|
||||
<ClCompile Include="usetiter.cpp" />
|
||||
<ClCompile Include="icuplug.cpp" />
|
||||
<ClCompile Include="serv.cpp" />
|
||||
<ClCompile Include="servlk.cpp" />
|
||||
<ClCompile Include="servlkf.cpp" />
|
||||
<ClCompile Include="servls.cpp" />
|
||||
<ClCompile Include="servnotf.cpp" />
|
||||
<ClCompile Include="servrbf.cpp" />
|
||||
<ClCompile Include="servslkf.cpp" />
|
||||
<ClCompile Include="usprep.cpp" />
|
||||
<ClCompile Include="appendable.cpp" />
|
||||
<ClCompile Include="bytesinkutil.cpp" />
|
||||
<ClCompile Include="bytestream.cpp" />
|
||||
<ClCompile Include="bytestrie.cpp" />
|
||||
<ClCompile Include="bytestriebuilder.cpp" />
|
||||
<ClCompile Include="bytestrieiterator.cpp" />
|
||||
<ClCompile Include="chariter.cpp" />
|
||||
<ClCompile Include="charstr.cpp" />
|
||||
<ClCompile Include="cstring.cpp" />
|
||||
<ClCompile Include="cstr.cpp" />
|
||||
<ClCompile Include="cwchar.cpp" />
|
||||
<ClCompile Include="messagepattern.cpp" />
|
||||
<ClCompile Include="schriter.cpp" />
|
||||
<ClCompile Include="stringpiece.cpp" />
|
||||
<ClCompile Include="stringtriebuilder.cpp" />
|
||||
<ClCompile Include="simpleformatter.cpp" />
|
||||
<ClCompile Include="ucasemap.cpp" />
|
||||
<ClCompile Include="ucasemap_titlecase_brkiter.cpp" />
|
||||
<ClCompile Include="ucharstrie.cpp" />
|
||||
<ClCompile Include="ucharstriebuilder.cpp" />
|
||||
<ClCompile Include="ucharstrieiterator.cpp" />
|
||||
<ClCompile Include="ucptrie.cpp" />
|
||||
<ClCompile Include="uchriter.cpp" />
|
||||
<ClCompile Include="uinvchar.cpp" />
|
||||
<ClCompile Include="uiter.cpp" />
|
||||
<ClCompile Include="umutablecptrie.cpp" />
|
||||
<ClCompile Include="unistr.cpp" />
|
||||
<ClCompile Include="unistr_case.cpp" />
|
||||
<ClCompile Include="unistr_case_locale.cpp" />
|
||||
<ClCompile Include="unistr_cnv.cpp" />
|
||||
<ClCompile Include="unistr_props.cpp" />
|
||||
<ClCompile Include="unistr_titlecase_brkiter.cpp" />
|
||||
<ClCompile Include="ustr_cnv.cpp" />
|
||||
<ClCompile Include="ustr_titlecase_brkiter.cpp" />
|
||||
<ClCompile Include="ustr_wcs.cpp" />
|
||||
<ClCompile Include="ustrcase.cpp" />
|
||||
<ClCompile Include="ustrcase_locale.cpp" />
|
||||
<ClCompile Include="ustring.cpp" />
|
||||
<ClCompile Include="ustrtrns.cpp" />
|
||||
<ClCompile Include="utext.cpp" />
|
||||
<ClCompile Include="utf_impl.cpp" />
|
||||
<ClCompile Include="static_unicode_sets.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="localsvc.h" />
|
||||
<ClInclude Include="msvcres.h" />
|
||||
<ClInclude Include="pluralmap.h" />
|
||||
<ClInclude Include="propname_data.h" />
|
||||
<ClInclude Include="ubidi_props.h" />
|
||||
<ClInclude Include="ubidiimp.h" />
|
||||
<ClInclude Include="brkeng.h" />
|
||||
<ClInclude Include="dictbe.h" />
|
||||
<ClInclude Include="rbbidata.h" />
|
||||
<ClInclude Include="rbbinode.h" />
|
||||
<ClInclude Include="rbbirb.h" />
|
||||
<ClInclude Include="rbbirpt.h" />
|
||||
<ClInclude Include="rbbiscan.h" />
|
||||
<ClInclude Include="rbbisetb.h" />
|
||||
<ClInclude Include="rbbitblb.h" />
|
||||
<ClInclude Include="rbbi_cache.h" />
|
||||
<ClInclude Include="dictionarydata.h" />
|
||||
<ClInclude Include="ubidi_props_data.h" />
|
||||
<ClInclude Include="ubrkimpl.h" />
|
||||
<ClInclude Include="ucase_props_data.h" />
|
||||
<ClInclude Include="uchar_props_data.h" />
|
||||
<ClInclude Include="ucol_data.h" />
|
||||
<ClInclude Include="ucol_swp.h" />
|
||||
<ClInclude Include="unicode\ubiditransform.h" />
|
||||
<ClInclude Include="unistrappender.h" />
|
||||
<ClInclude Include="hash.h" />
|
||||
<ClInclude Include="propsvec.h" />
|
||||
<ClInclude Include="uarrsort.h" />
|
||||
<ClInclude Include="uelement.h" />
|
||||
<ClInclude Include="uenumimp.h" />
|
||||
<ClInclude Include="uhash.h" />
|
||||
<ClInclude Include="ulist.h" />
|
||||
<ClInclude Include="unicode\filteredbrk.h" />
|
||||
<ClInclude Include="ustrenum.h" />
|
||||
<ClInclude Include="utrie.h" />
|
||||
<ClInclude Include="utrie2.h" />
|
||||
<ClInclude Include="utrie2_impl.h" />
|
||||
<ClInclude Include="utypeinfo.h" />
|
||||
<ClInclude Include="uvector.h" />
|
||||
<ClInclude Include="uvectr32.h" />
|
||||
<ClInclude Include="uvectr64.h" />
|
||||
<ClInclude Include="cpputils.h" />
|
||||
<ClInclude Include="locmap.h" />
|
||||
<ClInclude Include="mutex.h" />
|
||||
<ClInclude Include="putilimp.h" />
|
||||
<ClInclude Include="uassert.h" />
|
||||
<ClInclude Include="umutex.h" />
|
||||
<ClInclude Include="uposixdefs.h" />
|
||||
<ClInclude Include="utracimp.h" />
|
||||
<ClInclude Include="wintz.h" />
|
||||
<ClInclude Include="ucnv_bld.h" />
|
||||
<ClInclude Include="ucnv_cnv.h" />
|
||||
<ClInclude Include="ucnv_ext.h" />
|
||||
<ClInclude Include="ucnv_imp.h" />
|
||||
<ClInclude Include="ucnv_io.h" />
|
||||
<ClInclude Include="ucnvmbcs.h" />
|
||||
<ClInclude Include="cmemory.h" />
|
||||
<ClInclude Include="ucln.h" />
|
||||
<ClInclude Include="ucln_cmn.h" />
|
||||
<ClInclude Include="ucln_imp.h" />
|
||||
<ClInclude Include="ucmndata.h" />
|
||||
<ClInclude Include="udatamem.h" />
|
||||
<ClInclude Include="udataswp.h" />
|
||||
<ClInclude Include="umapfile.h" />
|
||||
<ClInclude Include="ustrfmt.h" />
|
||||
<ClInclude Include="util.h" />
|
||||
<ClInclude Include="punycode.h" />
|
||||
<ClInclude Include="locbased.h" />
|
||||
<ClInclude Include="locutil.h" />
|
||||
<ClInclude Include="sharedobject.h" />
|
||||
<ClCompile Include="sharedobject.cpp" />
|
||||
<ClInclude Include="ulocimp.h" />
|
||||
<ClInclude Include="unifiedcache.h" />
|
||||
<ClInclude Include="uresdata.h" />
|
||||
<ClInclude Include="uresimp.h" />
|
||||
<ClInclude Include="ureslocs.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="ucurrimp.h" />
|
||||
<ClInclude Include="norm2allmodes.h" />
|
||||
<ClInclude Include="normalizer2impl.h" />
|
||||
<ClInclude Include="unormimp.h" />
|
||||
<ClInclude Include="bmpset.h" />
|
||||
<ClInclude Include="messageimpl.h" />
|
||||
<ClInclude Include="patternprops.h" />
|
||||
<ClInclude Include="propname.h" />
|
||||
<ClInclude Include="ruleiter.h" />
|
||||
<ClInclude Include="ucase.h" />
|
||||
<ClInclude Include="unisetspan.h" />
|
||||
<ClInclude Include="uprops.h" />
|
||||
<ClInclude Include="usc_impl.h" />
|
||||
<ClInclude Include="uset_imp.h" />
|
||||
<ClInclude Include="icuplugimp.h" />
|
||||
<ClInclude Include="serv.h" />
|
||||
<ClInclude Include="servloc.h" />
|
||||
<ClInclude Include="servnotf.h" />
|
||||
<ClInclude Include="sprpimpl.h" />
|
||||
<ClInclude Include="bytesinkutil.h" />
|
||||
<ClInclude Include="charstr.h" />
|
||||
<ClInclude Include="cstring.h" />
|
||||
<ClInclude Include="cstr.h" />
|
||||
<ClInclude Include="cwchar.h" />
|
||||
<ClInclude Include="uinvchar.h" />
|
||||
<ClInclude Include="ustr_cnv.h" />
|
||||
<ClInclude Include="ustr_imp.h" />
|
||||
<ClInclude Include="static_unicode_sets.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="common.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,28 +40,10 @@
|
|||
#define uprv_strchr(s, c) U_STANDARD_CPP_NAMESPACE strchr(s, c)
|
||||
#define uprv_strstr(s, c) U_STANDARD_CPP_NAMESPACE strstr(s, c)
|
||||
#define uprv_strrchr(s, c) U_STANDARD_CPP_NAMESPACE strrchr(s, c)
|
||||
|
||||
#if U_DEBUG
|
||||
|
||||
#define uprv_strncpy(dst, src, size) ( \
|
||||
uprv_checkValidMemory(src, 1), \
|
||||
U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size))
|
||||
#define uprv_strncmp(s1, s2, n) ( \
|
||||
uprv_checkValidMemory(s1, 1), \
|
||||
uprv_checkValidMemory(s2, 1), \
|
||||
U_STANDARD_CPP_NAMESPACE strncmp(s1, s2, n))
|
||||
#define uprv_strncat(dst, src, n) ( \
|
||||
uprv_checkValidMemory(src, 1), \
|
||||
U_STANDARD_CPP_NAMESPACE strncat(dst, src, n))
|
||||
|
||||
#else
|
||||
|
||||
#define uprv_strncpy(dst, src, size) U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size)
|
||||
#define uprv_strncmp(s1, s2, n) U_STANDARD_CPP_NAMESPACE strncmp(s1, s2, n)
|
||||
#define uprv_strncat(dst, src, n) U_STANDARD_CPP_NAMESPACE strncat(dst, src, n)
|
||||
|
||||
#endif /* U_DEBUG */
|
||||
|
||||
/**
|
||||
* Is c an ASCII-repertoire letter a-z or A-Z?
|
||||
* Note: The implementation is specific to whether ICU is compiled for
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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.c
|
||||
* encoding: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,26 +29,23 @@ U_NAMESPACE_BEGIN
|
|||
******************************************************************
|
||||
*/
|
||||
|
||||
DictionaryBreakEngine::DictionaryBreakEngine(uint32_t breakTypes) {
|
||||
fTypes = breakTypes;
|
||||
DictionaryBreakEngine::DictionaryBreakEngine() {
|
||||
}
|
||||
|
||||
DictionaryBreakEngine::~DictionaryBreakEngine() {
|
||||
}
|
||||
|
||||
UBool
|
||||
DictionaryBreakEngine::handles(UChar32 c, int32_t breakType) const {
|
||||
return (breakType >= 0 && breakType < 32 && (((uint32_t)1 << breakType) & fTypes)
|
||||
&& fSet.contains(c));
|
||||
DictionaryBreakEngine::handles(UChar32 c) const {
|
||||
return fSet.contains(c);
|
||||
}
|
||||
|
||||
int32_t
|
||||
DictionaryBreakEngine::findBreaks( UText *text,
|
||||
int32_t startPos,
|
||||
int32_t endPos,
|
||||
UBool reverse,
|
||||
int32_t breakType,
|
||||
UStack &foundBreaks ) const {
|
||||
UVector32 &foundBreaks ) const {
|
||||
(void)startPos; // TODO: remove this param?
|
||||
int32_t result = 0;
|
||||
|
||||
// Find the span of characters included in the set.
|
||||
|
|
@ -60,38 +57,14 @@ DictionaryBreakEngine::findBreaks( UText *text,
|
|||
int32_t rangeStart;
|
||||
int32_t rangeEnd;
|
||||
UChar32 c = utext_current32(text);
|
||||
if (reverse) {
|
||||
UBool isDict = fSet.contains(c);
|
||||
while((current = (int32_t)utext_getNativeIndex(text)) > startPos && isDict) {
|
||||
c = utext_previous32(text);
|
||||
isDict = fSet.contains(c);
|
||||
}
|
||||
if (current < startPos) {
|
||||
rangeStart = startPos;
|
||||
} else {
|
||||
rangeStart = current;
|
||||
if (!isDict) {
|
||||
utext_next32(text);
|
||||
rangeStart = (int32_t)utext_getNativeIndex(text);
|
||||
}
|
||||
}
|
||||
// rangeEnd = start + 1;
|
||||
utext_setNativeIndex(text, start);
|
||||
utext_next32(text);
|
||||
rangeEnd = (int32_t)utext_getNativeIndex(text);
|
||||
}
|
||||
else {
|
||||
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;
|
||||
}
|
||||
if (breakType >= 0 && breakType < 32 && (((uint32_t)1 << breakType) & fTypes)) {
|
||||
result = divideUpDictionaryRange(text, rangeStart, rangeEnd, foundBreaks);
|
||||
utext_setNativeIndex(text, current);
|
||||
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);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -216,7 +189,7 @@ 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((1<<UBRK_WORD) | (1<<UBRK_LINE)),
|
||||
: DictionaryBreakEngine(),
|
||||
fDictionary(adoptDictionary)
|
||||
{
|
||||
fThaiWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Thai:]&[:LineBreak=SA:]]"), status);
|
||||
|
|
@ -248,7 +221,7 @@ int32_t
|
|||
ThaiBreakEngine::divideUpDictionaryRange( UText *text,
|
||||
int32_t rangeStart,
|
||||
int32_t rangeEnd,
|
||||
UStack &foundBreaks ) const {
|
||||
UVector32 &foundBreaks ) const {
|
||||
utext_setNativeIndex(text, rangeStart);
|
||||
utext_moveIndex32(text, THAI_MIN_WORD_SPAN);
|
||||
if (utext_getNativeIndex(text) >= rangeEnd) {
|
||||
|
|
@ -352,9 +325,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 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 (candidates > 0) {
|
||||
if (num_candidates > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -458,7 +431,7 @@ 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((1<<UBRK_WORD) | (1<<UBRK_LINE)),
|
||||
: DictionaryBreakEngine(),
|
||||
fDictionary(adoptDictionary)
|
||||
{
|
||||
fLaoWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Laoo:]&[:LineBreak=SA:]]"), status);
|
||||
|
|
@ -487,7 +460,7 @@ int32_t
|
|||
LaoBreakEngine::divideUpDictionaryRange( UText *text,
|
||||
int32_t rangeStart,
|
||||
int32_t rangeEnd,
|
||||
UStack &foundBreaks ) const {
|
||||
UVector32 &foundBreaks ) const {
|
||||
if ((rangeEnd - rangeStart) < LAO_MIN_WORD_SPAN) {
|
||||
return 0; // Not enough characters for two words
|
||||
}
|
||||
|
|
@ -582,9 +555,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 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 (candidates > 0) {
|
||||
if (num_candidates > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -654,7 +627,7 @@ 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((1<<UBRK_WORD) | (1<<UBRK_LINE)),
|
||||
: DictionaryBreakEngine(),
|
||||
fDictionary(adoptDictionary)
|
||||
{
|
||||
fBurmeseWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Mymr:]&[:LineBreak=SA:]]"), status);
|
||||
|
|
@ -680,7 +653,7 @@ int32_t
|
|||
BurmeseBreakEngine::divideUpDictionaryRange( UText *text,
|
||||
int32_t rangeStart,
|
||||
int32_t rangeEnd,
|
||||
UStack &foundBreaks ) const {
|
||||
UVector32 &foundBreaks ) const {
|
||||
if ((rangeEnd - rangeStart) < BURMESE_MIN_WORD_SPAN) {
|
||||
return 0; // Not enough characters for two words
|
||||
}
|
||||
|
|
@ -775,9 +748,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 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 (candidates > 0) {
|
||||
if (num_candidates > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -847,7 +820,7 @@ 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((1 << UBRK_WORD) | (1 << UBRK_LINE)),
|
||||
: DictionaryBreakEngine(),
|
||||
fDictionary(adoptDictionary)
|
||||
{
|
||||
fKhmerWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Khmr:]&[:LineBreak=SA:]]"), status);
|
||||
|
|
@ -885,7 +858,7 @@ int32_t
|
|||
KhmerBreakEngine::divideUpDictionaryRange( UText *text,
|
||||
int32_t rangeStart,
|
||||
int32_t rangeEnd,
|
||||
UStack &foundBreaks ) const {
|
||||
UVector32 &foundBreaks ) const {
|
||||
if ((rangeEnd - rangeStart) < KHMER_MIN_WORD_SPAN) {
|
||||
return 0; // Not enough characters for two words
|
||||
}
|
||||
|
|
@ -980,9 +953,9 @@ foundBest:
|
|||
uc = utext_current32(text);
|
||||
if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) {
|
||||
// Maybe. See if it's in the dictionary.
|
||||
int32_t 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 (candidates > 0) {
|
||||
if (num_candidates > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1069,7 +1042,7 @@ foundBest:
|
|||
*/
|
||||
static const uint32_t kuint32max = 0xFFFFFFFF;
|
||||
CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType type, UErrorCode &status)
|
||||
: DictionaryBreakEngine(1 << UBRK_WORD), fDictionary(adoptDictionary) {
|
||||
: DictionaryBreakEngine(), fDictionary(adoptDictionary) {
|
||||
// Korean dictionary only includes Hangul syllables
|
||||
fHangulWordSet.applyPattern(UNICODE_STRING_SIMPLE("[\\uac00-\\ud7a3]"), status);
|
||||
fHanWordSet.applyPattern(UNICODE_STRING_SIMPLE("[:Han:]"), status);
|
||||
|
|
@ -1110,9 +1083,9 @@ static inline uint32_t getKatakanaCost(int32_t wordLength){
|
|||
return (wordLength > kMaxKatakanaLength) ? 8192 : katakanaCost[wordLength];
|
||||
}
|
||||
|
||||
static inline bool isKatakana(uint16_t value) {
|
||||
return (value >= 0x30A1u && value <= 0x30FEu && value != 0x30FBu) ||
|
||||
(value >= 0xFF66u && value <= 0xFF9fu);
|
||||
static inline bool isKatakana(UChar32 value) {
|
||||
return (value >= 0x30A1 && value <= 0x30FE && value != 0x30FB) ||
|
||||
(value >= 0xFF66 && value <= 0xFF9f);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1128,14 +1101,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 Output of C array of int32_t break positions, or 0
|
||||
* @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,
|
||||
UStack &foundBreaks ) const {
|
||||
UVector32 &foundBreaks ) const {
|
||||
if (rangeStart >= rangeEnd) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1346,8 +1319,8 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
|
|||
}
|
||||
if (katakanaRunLength < kMaxKatakanaGroupLength) {
|
||||
uint32_t newSnlp = bestSnlp.elementAti(i) + getKatakanaCost(katakanaRunLength);
|
||||
if (newSnlp < (uint32_t)bestSnlp.elementAti(j)) {
|
||||
bestSnlp.setElementAt(newSnlp, j);
|
||||
if (newSnlp < (uint32_t)bestSnlp.elementAti(i+katakanaRunLength)) {
|
||||
bestSnlp.setElementAt(newSnlp, i+katakanaRunLength);
|
||||
prev.setElementAt(i, i+katakanaRunLength); // prev[j] = i;
|
||||
}
|
||||
}
|
||||
|
|
@ -1385,13 +1358,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;
|
||||
for (int32_t i = numBreaks-1; i >= 0; i--) {
|
||||
int32_t cpPos = t_boundary.elementAti(i);
|
||||
U_ASSERT(cpPos > prevCPPos);
|
||||
int32_t utextPos = inputMap.isValid() ? inputMap->elementAti(cpPos) : cpPos + rangeStart;
|
||||
// Boundaries are added to foundBreaks output in ascending order.
|
||||
U_ASSERT(foundBreaks.size() == 0 ||foundBreaks.peeki() < utextPos);
|
||||
foundBreaks.push(utextPos, status);
|
||||
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
|
||||
|
||||
// inString goes out of scope
|
||||
// inputMap goes out of scope
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,6 +15,7 @@
|
|||
#include "unicode/utext.h"
|
||||
|
||||
#include "brkeng.h"
|
||||
#include "uvectr32.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
|
|
@ -41,27 +42,12 @@ class DictionaryBreakEngine : public LanguageBreakEngine {
|
|||
|
||||
UnicodeSet fSet;
|
||||
|
||||
/**
|
||||
* The set of break types handled by this engine
|
||||
* @internal
|
||||
*/
|
||||
|
||||
uint32_t fTypes;
|
||||
|
||||
/**
|
||||
* <p>Default constructor.</p>
|
||||
*
|
||||
*/
|
||||
DictionaryBreakEngine();
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* <p>Constructor setting the break types handled.</p>
|
||||
*
|
||||
* @param breakTypes A bitmap of types handled by the engine.
|
||||
* <p>Constructor </p>
|
||||
*/
|
||||
DictionaryBreakEngine( uint32_t breakTypes );
|
||||
DictionaryBreakEngine();
|
||||
|
||||
/**
|
||||
* <p>Virtual destructor.</p>
|
||||
|
|
@ -73,32 +59,26 @@ class DictionaryBreakEngine : public LanguageBreakEngine {
|
|||
* a particular kind of break.</p>
|
||||
*
|
||||
* @param c A character which begins a run that the engine might handle
|
||||
* @param breakType The type of text break which the caller wants to determine
|
||||
* @return TRUE if this engine handles the particular character and break
|
||||
* type.
|
||||
*/
|
||||
virtual UBool handles( UChar32 c, int32_t breakType ) const;
|
||||
virtual UBool handles(UChar32 c) const;
|
||||
|
||||
/**
|
||||
* <p>Find any breaks within a run in the supplied text.</p>
|
||||
*
|
||||
* @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 (or last) 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 reverse Whether the caller is looking for breaks in a reverse
|
||||
* direction.
|
||||
* @param breakType The type of break desired, or -1.
|
||||
* @param foundBreaks An allocated C array of the breaks found, if any
|
||||
* @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,
|
||||
UBool reverse,
|
||||
int32_t breakType,
|
||||
UStack &foundBreaks ) const;
|
||||
UVector32 &foundBreaks ) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
@ -109,13 +89,6 @@ class DictionaryBreakEngine : public LanguageBreakEngine {
|
|||
*/
|
||||
virtual void setCharacters( const UnicodeSet &set );
|
||||
|
||||
/**
|
||||
* <p>Set the break types handled by this engine.</p>
|
||||
*
|
||||
* @param breakTypes A bitmap of types handled by the engine.
|
||||
*/
|
||||
// virtual void setBreakTypes( uint32_t breakTypes );
|
||||
|
||||
/**
|
||||
* <p>Divide up a range of known dictionary characters handled by this break engine.</p>
|
||||
*
|
||||
|
|
@ -128,7 +101,7 @@ class DictionaryBreakEngine : public LanguageBreakEngine {
|
|||
virtual int32_t divideUpDictionaryRange( UText *text,
|
||||
int32_t rangeStart,
|
||||
int32_t rangeEnd,
|
||||
UStack &foundBreaks ) const = 0;
|
||||
UVector32 &foundBreaks ) const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -185,7 +158,7 @@ class ThaiBreakEngine : public DictionaryBreakEngine {
|
|||
virtual int32_t divideUpDictionaryRange( UText *text,
|
||||
int32_t rangeStart,
|
||||
int32_t rangeEnd,
|
||||
UStack &foundBreaks ) const;
|
||||
UVector32 &foundBreaks ) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -241,7 +214,7 @@ class LaoBreakEngine : public DictionaryBreakEngine {
|
|||
virtual int32_t divideUpDictionaryRange( UText *text,
|
||||
int32_t rangeStart,
|
||||
int32_t rangeEnd,
|
||||
UStack &foundBreaks ) const;
|
||||
UVector32 &foundBreaks ) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -297,7 +270,7 @@ class BurmeseBreakEngine : public DictionaryBreakEngine {
|
|||
virtual int32_t divideUpDictionaryRange( UText *text,
|
||||
int32_t rangeStart,
|
||||
int32_t rangeEnd,
|
||||
UStack &foundBreaks ) const;
|
||||
UVector32 &foundBreaks ) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -353,7 +326,7 @@ class KhmerBreakEngine : public DictionaryBreakEngine {
|
|||
virtual int32_t divideUpDictionaryRange( UText *text,
|
||||
int32_t rangeStart,
|
||||
int32_t rangeEnd,
|
||||
UStack &foundBreaks ) const;
|
||||
UVector32 &foundBreaks ) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -417,7 +390,7 @@ class CjkBreakEngine : public DictionaryBreakEngine {
|
|||
virtual int32_t divideUpDictionaryRange( UText *text,
|
||||
int32_t rangeStart,
|
||||
int32_t rangeEnd,
|
||||
UStack &foundBreaks ) const;
|
||||
UVector32 &foundBreaks ) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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
|
||||
|
|
|
|||
803
intl/icu/source/common/edits.cpp
Normal file
803
intl/icu/source/common/edits.cpp
Normal file
|
|
@ -0,0 +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) {
|
||||
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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
|
|
@ -694,7 +694,12 @@ FilteredBreakIteratorBuilder::createInstance(const Locale& where, UErrorCode& st
|
|||
}
|
||||
|
||||
FilteredBreakIteratorBuilder *
|
||||
FilteredBreakIteratorBuilder::createInstance(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;
|
||||
|
|
@ -702,4 +707,4 @@ FilteredBreakIteratorBuilder::createInstance(UErrorCode& status) {
|
|||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif //#if !UCONFIG_NO_BREAK_ITERATION && U_HAVE_STD_STRING && !UCONFIG_NO_FILTERED_BREAK_ITERATION
|
||||
#endif //#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -20,7 +20,9 @@
|
|||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
#include "unicode/edits.h"
|
||||
#include "unicode/normalizer2.h"
|
||||
#include "unicode/stringoptions.h"
|
||||
#include "unicode/uniset.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/unorm.h"
|
||||
|
|
@ -85,6 +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;
|
||||
}
|
||||
}
|
||||
|
||||
UnicodeString &
|
||||
FilteredNormalizer2::normalizeSecondAndAppend(UnicodeString &first,
|
||||
const UnicodeString &second,
|
||||
|
|
@ -196,6 +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;
|
||||
}
|
||||
|
||||
UNormalizationCheckResult
|
||||
FilteredNormalizer2::quickCheck(const UnicodeString &s, UErrorCode &errorCode) const {
|
||||
uprv_checkCanGetBuffer(s, errorCode);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,6 +33,8 @@ 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);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Construct a hashtable
|
||||
|
|
@ -41,6 +43,14 @@ public:
|
|||
*/
|
||||
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
|
||||
*/
|
||||
Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& status);
|
||||
|
||||
/**
|
||||
* Construct a hashtable
|
||||
* @param keyComp Comparator for comparing the keys
|
||||
|
|
@ -76,9 +86,9 @@ public:
|
|||
int32_t puti(const UnicodeString& key, int32_t value, UErrorCode& status);
|
||||
|
||||
void* get(const UnicodeString& key) const;
|
||||
|
||||
|
||||
int32_t geti(const UnicodeString& key) const;
|
||||
|
||||
|
||||
void* remove(const UnicodeString& key);
|
||||
|
||||
int32_t removei(const UnicodeString& key);
|
||||
|
|
@ -92,9 +102,9 @@ public:
|
|||
* @see uhash_nextElement
|
||||
*/
|
||||
const UHashElement* nextElement(int32_t& pos) const;
|
||||
|
||||
|
||||
UKeyComparator* setKeyComparator(UKeyComparator*keyComp);
|
||||
|
||||
|
||||
UValueComparator* setValueComparator(UValueComparator* valueComp);
|
||||
|
||||
UBool equals(const Hashtable& that) const;
|
||||
|
|
@ -107,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;
|
||||
|
|
@ -119,10 +129,23 @@ inline void Hashtable::init(UHashFunction *keyHash, UKeyComparator *keyComp,
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -134,6 +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(UErrorCode& status)
|
||||
: hash(0)
|
||||
{
|
||||
|
|
@ -200,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,6 +18,7 @@
|
|||
#include "unicode/udata.h"
|
||||
#include "unicode/localpointer.h"
|
||||
#include "unicode/normalizer2.h"
|
||||
#include "unicode/ucptrie.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/unorm.h"
|
||||
#include "cstring.h"
|
||||
|
|
@ -42,12 +43,12 @@ private:
|
|||
isAcceptable(void *context, const char *type, const char *name, const UDataInfo *pInfo);
|
||||
|
||||
UDataMemory *memory;
|
||||
UTrie2 *ownedTrie;
|
||||
UCPTrie *ownedTrie;
|
||||
};
|
||||
|
||||
LoadedNormalizer2Impl::~LoadedNormalizer2Impl() {
|
||||
udata_close(memory);
|
||||
utrie2_close(ownedTrie);
|
||||
ucptrie_close(ownedTrie);
|
||||
}
|
||||
|
||||
UBool U_CALLCONV
|
||||
|
|
@ -62,7 +63,7 @@ LoadedNormalizer2Impl::isAcceptable(void * /*context*/,
|
|||
pInfo->dataFormat[1]==0x72 &&
|
||||
pInfo->dataFormat[2]==0x6d &&
|
||||
pInfo->dataFormat[3]==0x32 &&
|
||||
pInfo->formatVersion[0]==2
|
||||
pInfo->formatVersion[0]==4
|
||||
) {
|
||||
// Normalizer2Impl *me=(Normalizer2Impl *)context;
|
||||
// uprv_memcpy(me->dataVersion, pInfo->dataVersion, 4);
|
||||
|
|
@ -84,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_MAYBE_YES) {
|
||||
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=utrie2_openFromSerialized(UTRIE2_16_VALUE_BITS,
|
||||
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;
|
||||
}
|
||||
|
|
@ -131,15 +132,26 @@ U_CDECL_BEGIN
|
|||
static UBool U_CALLCONV uprv_loaded_normalizer2_cleanup();
|
||||
U_CDECL_END
|
||||
|
||||
static Norm2AllModes *nfkcSingleton;
|
||||
static Norm2AllModes *nfkc_cfSingleton;
|
||||
static UHashtable *cache=NULL;
|
||||
#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 Norm2AllModes *nfkc_cfSingleton;
|
||||
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 (uprv_strcmp(what, "nfkc") == 0) {
|
||||
nfkcSingleton = Norm2AllModes::createInstance(NULL, "nfkc", errorCode);
|
||||
} else if (uprv_strcmp(what, "nfkc_cf") == 0) {
|
||||
|
|
@ -157,19 +169,36 @@ 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
|
||||
|
||||
delete nfkcSingleton;
|
||||
nfkcSingleton = NULL;
|
||||
nfkcInitOnce.reset();
|
||||
|
||||
delete nfkc_cfSingleton;
|
||||
nfkc_cfSingleton = NULL;
|
||||
nfkc_cfInitOnce.reset();
|
||||
|
||||
uhash_close(cache);
|
||||
cache=NULL;
|
||||
nfkcInitOnce.reset();
|
||||
nfkc_cfInitOnce.reset();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
#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::getNFKCInstance(UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) { return NULL; }
|
||||
|
|
@ -184,6 +213,36 @@ Norm2AllModes::getNFKC_CFInstance(UErrorCode &errorCode) {
|
|||
return nfkc_cfSingleton;
|
||||
}
|
||||
|
||||
#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::getNFKCInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode);
|
||||
|
|
@ -232,6 +291,7 @@ Normalizer2::getInstance(const char *packageName,
|
|||
}
|
||||
}
|
||||
if(allModes==NULL) {
|
||||
ucln_common_registerCleanup(UCLN_COMMON_LOADED_NORMALIZER2, uprv_loaded_normalizer2_cleanup);
|
||||
LocalPointer<Norm2AllModes> localAllModes(
|
||||
Norm2AllModes::createInstance(packageName, name, errorCode));
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
|
|
@ -246,7 +306,7 @@ Normalizer2::getInstance(const char *packageName,
|
|||
}
|
||||
void *temp=uhash_get(cache, name);
|
||||
if(temp==NULL) {
|
||||
int32_t keyLength=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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
***************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -35,7 +35,7 @@ U_NAMESPACE_BEGIN
|
|||
|
||||
static icu::Locale* availableLocaleList = NULL;
|
||||
static int32_t availableLocaleListCount;
|
||||
static icu::UInitOnce gInitOnce = U_INITONCE_INITIALIZER;
|
||||
static icu::UInitOnce gInitOnceLocale = U_INITONCE_INITIALIZER;
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ static UBool U_CALLCONV locale_available_cleanup(void)
|
|||
availableLocaleList = NULL;
|
||||
}
|
||||
availableLocaleListCount = 0;
|
||||
gInitOnce.reset();
|
||||
gInitOnceLocale.reset();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ void U_CALLCONV locale_available_init() {
|
|||
const Locale* U_EXPORT2
|
||||
Locale::getAvailableLocales(int32_t& count)
|
||||
{
|
||||
umtx_initOnce(gInitOnce, &locale_available_init);
|
||||
umtx_initOnce(gInitOnceLocale, &locale_available_init);
|
||||
count = availableLocaleListCount;
|
||||
return availableLocaleList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -542,7 +542,7 @@ uloc_getDisplayName(const char *locale,
|
|||
return 0;
|
||||
}
|
||||
separator = (const UChar *)p0 + subLen;
|
||||
sepLen = p1 - separator;
|
||||
sepLen = static_cast<int32_t>(p1 - separator);
|
||||
}
|
||||
|
||||
if(patLen==0 || (patLen==defaultPatLen && !u_strncmp(pattern, defaultPattern, patLen))) {
|
||||
|
|
@ -558,8 +558,8 @@ uloc_getDisplayName(const char *locale,
|
|||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
sub0Pos=p0-pattern;
|
||||
sub1Pos=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;
|
||||
|
|
@ -821,6 +821,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 the keyword is equal to currency .. then to get the display name
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,6 +13,7 @@
|
|||
|
||||
#include "unicode/locdspnm.h"
|
||||
#include "unicode/simpleformatter.h"
|
||||
#include "unicode/ucasemap.h"
|
||||
#include "unicode/ures.h"
|
||||
#include "unicode/udisplaycontext.h"
|
||||
#include "unicode/brkiter.h"
|
||||
|
|
@ -44,16 +45,16 @@ static int32_t ncat(char *buffer, uint32_t buflen, ...) {
|
|||
}
|
||||
|
||||
va_start(args, buflen);
|
||||
while ((str = va_arg(args, char *))) {
|
||||
while ((str = va_arg(args, char *)) != 0) {
|
||||
char c;
|
||||
while (p != e && (c = *str++)) {
|
||||
while (p != e && (c = *str++) != 0) {
|
||||
*p++ = c;
|
||||
}
|
||||
}
|
||||
*p = 0;
|
||||
va_end(args);
|
||||
|
||||
return p - buffer;
|
||||
return static_cast<int32_t>(p - buffer);
|
||||
}
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
|
@ -97,7 +98,7 @@ ICUDataTable::ICUDataTable(const char* path, const Locale& locale)
|
|||
: path(NULL), locale(Locale::getRoot())
|
||||
{
|
||||
if (path) {
|
||||
int32_t len = 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);
|
||||
|
|
@ -559,21 +560,21 @@ LocaleDisplayNamesImpl::adjustForUsageAndContext(CapContextUsage usage,
|
|||
}
|
||||
|
||||
UnicodeString&
|
||||
LocaleDisplayNamesImpl::localeDisplayName(const Locale& locale,
|
||||
LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
|
||||
UnicodeString& result) const {
|
||||
if (locale.isBogus()) {
|
||||
if (loc.isBogus()) {
|
||||
result.setToBogus();
|
||||
return result;
|
||||
}
|
||||
UnicodeString resultName;
|
||||
|
||||
const char* lang = locale.getLanguage();
|
||||
const char* lang = loc.getLanguage();
|
||||
if (uprv_strlen(lang) == 0) {
|
||||
lang = "root";
|
||||
}
|
||||
const char* script = locale.getScript();
|
||||
const char* country = locale.getCountry();
|
||||
const char* variant = locale.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;
|
||||
|
|
@ -629,14 +630,15 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& locale,
|
|||
resultRemainder.findAndReplace(formatOpenParen, formatReplaceOpenParen);
|
||||
resultRemainder.findAndReplace(formatCloseParen, formatReplaceCloseParen);
|
||||
|
||||
LocalPointer<StringEnumeration> e(locale.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) {
|
||||
locale.getKeywordValue(key, value, ULOC_KEYWORD_AND_VALUES_CAPACITY, status);
|
||||
if (U_FAILURE(status)) {
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,8 +31,12 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "unicode/bytestream.h"
|
||||
#include "unicode/locid.h"
|
||||
#include "unicode/strenum.h"
|
||||
#include "unicode/stringpiece.h"
|
||||
#include "unicode/uloc.h"
|
||||
#include "putilimp.h"
|
||||
#include "mutex.h"
|
||||
|
|
@ -42,9 +46,11 @@
|
|||
#include "cstring.h"
|
||||
#include "uassert.h"
|
||||
#include "uhash.h"
|
||||
#include "ulocimp.h"
|
||||
#include "ucln_cmn.h"
|
||||
#include "ustr_imp.h"
|
||||
#include "charstr.h"
|
||||
#include "bytesinkutil.h"
|
||||
|
||||
U_CDECL_BEGIN
|
||||
static UBool U_CALLCONV locale_cleanup(void);
|
||||
|
|
@ -423,49 +429,70 @@ Locale::Locale(const Locale &other)
|
|||
*this = 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;
|
||||
}
|
||||
|
||||
/* Free our current storage */
|
||||
if (baseName != fullName) {
|
||||
uprv_free(baseName);
|
||||
}
|
||||
baseName = NULL;
|
||||
if(fullName != fullNameBuffer) {
|
||||
uprv_free(fullName);
|
||||
fullName = fullNameBuffer;
|
||||
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;
|
||||
}
|
||||
|
||||
/* Allocate the full name if necessary */
|
||||
if(other.fullName != other.fullNameBuffer) {
|
||||
fullName = (char *)uprv_malloc(sizeof(char)*(uprv_strlen(other.fullName)+1));
|
||||
if (fullName == NULL) {
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
/* Copy the full name */
|
||||
uprv_strcpy(fullName, other.fullName);
|
||||
|
||||
/* Copy the baseName if it differs from fullName. */
|
||||
if (other.baseName == other.fullName) {
|
||||
baseName = fullName;
|
||||
} else {
|
||||
if (other.baseName) {
|
||||
baseName = uprv_strdup(other.baseName);
|
||||
}
|
||||
} else if (other.baseName != nullptr) {
|
||||
baseName = uprv_strdup(other.baseName);
|
||||
if (baseName == nullptr) return *this;
|
||||
}
|
||||
|
||||
/* Copy the language and country fields */
|
||||
uprv_strcpy(language, other.language);
|
||||
uprv_strcpy(script, other.script);
|
||||
uprv_strcpy(country, other.country);
|
||||
|
||||
/* The variantBegin is an offset, just copy it */
|
||||
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;
|
||||
}
|
||||
|
||||
uprv_strcpy(language, other.language);
|
||||
uprv_strcpy(script, other.script);
|
||||
uprv_strcpy(country, other.country);
|
||||
|
||||
variantBegin = other.variantBegin;
|
||||
fIsBogus = other.fIsBogus;
|
||||
|
||||
other.baseName = other.fullName = other.fullNameBuffer;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -544,7 +571,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
|
|||
/* after uloc_getName/canonicalize() we know that only '_' are separators */
|
||||
separator = field[0] = fullName;
|
||||
fieldIdx = 1;
|
||||
while ((separator = uprv_strchr(field[fieldIdx-1], SEP_CHAR)) && fieldIdx < UPRV_LENGTHOF(field)-1) {
|
||||
while ((separator = uprv_strchr(field[fieldIdx-1], SEP_CHAR)) != 0 && fieldIdx < UPRV_LENGTHOF(field)-1) {
|
||||
field[fieldIdx] = separator + 1;
|
||||
fieldLen[fieldIdx-1] = (int32_t)(separator - field[fieldIdx-1]);
|
||||
fieldIdx++;
|
||||
|
|
@ -651,7 +678,7 @@ Locale::initBaseName(UErrorCode &status) {
|
|||
int32_t
|
||||
Locale::hashCode() const
|
||||
{
|
||||
return ustr_hashCharsN(fullName, uprv_strlen(fullName));
|
||||
return ustr_hashCharsN(fullName, static_cast<int32_t>(uprv_strlen(fullName)));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -703,6 +730,276 @@ Locale::setDefault( const Locale& newLocale,
|
|||
locale_set_default_internal(localeID, status);
|
||||
}
|
||||
|
||||
void
|
||||
Locale::addLikelySubtags(UErrorCode& status) {
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The maximized locale ID string is often longer, but there is no good
|
||||
// heuristic to estimate just how much longer. Leave that to CharString.
|
||||
CharString maximizedLocaleID;
|
||||
int32_t maximizedLocaleIDCapacity = static_cast<int32_t>(uprv_strlen(fullName));
|
||||
|
||||
char* buffer;
|
||||
int32_t reslen;
|
||||
|
||||
for (;;) {
|
||||
buffer = maximizedLocaleID.getAppendBuffer(
|
||||
/*minCapacity=*/maximizedLocaleIDCapacity,
|
||||
/*desiredCapacityHint=*/maximizedLocaleIDCapacity,
|
||||
maximizedLocaleIDCapacity,
|
||||
status);
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
reslen = uloc_addLikelySubtags(
|
||||
fullName,
|
||||
buffer,
|
||||
maximizedLocaleIDCapacity,
|
||||
&status);
|
||||
|
||||
if (status != U_BUFFER_OVERFLOW_ERROR) {
|
||||
break;
|
||||
}
|
||||
|
||||
maximizedLocaleIDCapacity = reslen;
|
||||
status = U_ZERO_ERROR;
|
||||
}
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
maximizedLocaleID.append(buffer, reslen, status);
|
||||
if (status == U_STRING_NOT_TERMINATED_WARNING) {
|
||||
status = U_ZERO_ERROR; // Terminators provided by CharString.
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Except for a few edge cases (like the empty string, that is minimized to
|
||||
// "en__POSIX"), minimized locale ID strings will be either the same length
|
||||
// or shorter than their input.
|
||||
CharString minimizedLocaleID;
|
||||
int32_t minimizedLocaleIDCapacity = static_cast<int32_t>(uprv_strlen(fullName));
|
||||
|
||||
char* buffer;
|
||||
int32_t reslen;
|
||||
|
||||
for (;;) {
|
||||
buffer = minimizedLocaleID.getAppendBuffer(
|
||||
/*minCapacity=*/minimizedLocaleIDCapacity,
|
||||
/*desiredCapacityHint=*/minimizedLocaleIDCapacity,
|
||||
minimizedLocaleIDCapacity,
|
||||
status);
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
reslen = uloc_minimizeSubtags(
|
||||
fullName,
|
||||
buffer,
|
||||
minimizedLocaleIDCapacity,
|
||||
&status);
|
||||
|
||||
if (status != U_BUFFER_OVERFLOW_ERROR) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Because of the internal minimal buffer size of CharString, I can't
|
||||
// think of any input data for which this could possibly ever happen.
|
||||
// Maybe it would be better replaced with an assertion instead?
|
||||
minimizedLocaleIDCapacity = reslen;
|
||||
status = U_ZERO_ERROR;
|
||||
}
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
minimizedLocaleID.append(buffer, reslen, status);
|
||||
if (status == U_STRING_NOT_TERMINATED_WARNING) {
|
||||
status = U_ZERO_ERROR; // Terminators provided by CharString.
|
||||
}
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
init(minimizedLocaleID.data(), /*canonicalize=*/FALSE);
|
||||
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.
|
||||
|
||||
// All simple language tags will have the exact same length as ICU locale
|
||||
// ID strings as they have as BCP-47 strings (like "en_US" for "en-US").
|
||||
CharString localeID;
|
||||
int32_t resultCapacity = tag.size();
|
||||
|
||||
char* buffer;
|
||||
int32_t parsedLength, reslen;
|
||||
|
||||
for (;;) {
|
||||
buffer = localeID.getAppendBuffer(
|
||||
/*minCapacity=*/resultCapacity,
|
||||
/*desiredCapacityHint=*/resultCapacity,
|
||||
resultCapacity,
|
||||
status);
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
reslen = ulocimp_forLanguageTag(
|
||||
tag.data(),
|
||||
tag.length(),
|
||||
buffer,
|
||||
resultCapacity,
|
||||
&parsedLength,
|
||||
&status);
|
||||
|
||||
if (status != U_BUFFER_OVERFLOW_ERROR) {
|
||||
break;
|
||||
}
|
||||
|
||||
// For all BCP-47 language tags that use extensions, the corresponding
|
||||
// ICU locale ID will be longer but uloc_forLanguageTag() does compute
|
||||
// the exact length needed so this memory reallocation will be done at
|
||||
// most once.
|
||||
resultCapacity = reslen;
|
||||
status = U_ZERO_ERROR;
|
||||
}
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (parsedLength != tag.size()) {
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return result;
|
||||
}
|
||||
|
||||
localeID.append(buffer, reslen, status);
|
||||
if (status == U_STRING_NOT_TERMINATED_WARNING) {
|
||||
status = U_ZERO_ERROR; // Terminators provided by CharString.
|
||||
}
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
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;
|
||||
}
|
||||
|
||||
// All simple language tags will have the exact same length as BCP-47
|
||||
// strings as they have as ICU locale IDs (like "en-US" for "en_US").
|
||||
LocalMemory<char> scratch;
|
||||
int32_t scratch_capacity = static_cast<int32_t>(uprv_strlen(fullName));
|
||||
|
||||
if (scratch_capacity == 0) {
|
||||
scratch_capacity = 3; // "und"
|
||||
}
|
||||
|
||||
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_toLanguageTag(
|
||||
fullName,
|
||||
buffer,
|
||||
result_capacity,
|
||||
/*strict=*/FALSE,
|
||||
&status);
|
||||
|
||||
if (status != U_BUFFER_OVERFLOW_ERROR) {
|
||||
break;
|
||||
}
|
||||
|
||||
// For some very few edge cases a language tag will be longer as a
|
||||
// BCP-47 string than it is as an ICU locale ID. Most notoriously "C"
|
||||
// expands to the BCP-47 tag "en-US-u-va-posix", 16 times longer, and
|
||||
// it'll take several calls to uloc_toLanguageTag() to figure that out.
|
||||
// https://unicode-org.atlassian.net/browse/ICU-20132
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
Locale U_EXPORT2
|
||||
Locale::createFromName (const char *name)
|
||||
{
|
||||
|
|
@ -1009,20 +1306,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;
|
||||
|
||||
StringEnumeration *
|
||||
Locale::createKeywords(UErrorCode &status) const
|
||||
{
|
||||
char keywords[256];
|
||||
int32_t keywordCapacity = 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, NULL, 0, NULL, FALSE, &status);
|
||||
if(keyLen) {
|
||||
if(U_SUCCESS(status) && keyLen) {
|
||||
result = new KeywordEnumeration(keywords, keyLen, 0, status);
|
||||
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, NULL, 0, NULL, 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;
|
||||
|
|
@ -1037,6 +1398,105 @@ Locale::getKeywordValue(const char* keywordName, char *buffer, int32_t bufLen, U
|
|||
return uloc_getKeywordValue(fullName, keywordName, buffer, bufLen, &status);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -1047,6 +1507,46 @@ Locale::setKeywordValue(const char* keywordName, const char* keywordValue, UErro
|
|||
}
|
||||
}
|
||||
|
||||
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 =
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
#include "unicode/utypes.h"
|
||||
#include "unicode/locid.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "unicode/uchar.h"
|
||||
#include "unicode/uloc.h"
|
||||
#include "unicode/ures.h"
|
||||
#include "unicode/uscript.h"
|
||||
|
|
@ -510,7 +511,7 @@ parseTagString(
|
|||
unknownLanguage);
|
||||
*langLength = (int32_t)uprv_strlen(lang);
|
||||
}
|
||||
else if (_isIDSeparator(*position)) {
|
||||
if (_isIDSeparator(*position)) {
|
||||
++position;
|
||||
}
|
||||
|
||||
|
|
@ -1280,7 +1281,7 @@ uloc_minimizeSubtags(const char* localeID,
|
|||
|
||||
// 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 uloc_addLikelySubtags().
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,6 +30,7 @@
|
|||
#include "locmap.h"
|
||||
#include "cstring.h"
|
||||
#include "cmemory.h"
|
||||
#include "unicode/uloc.h"
|
||||
|
||||
#if U_PLATFORM == U_PF_WINDOWS && defined(_MSC_VER) && (_MSC_VER >= 1500)
|
||||
/*
|
||||
|
|
@ -40,10 +41,7 @@
|
|||
* We might need to #include some Windows header and test for some version macro from there.
|
||||
* Or call some Windows function and see what it returns.
|
||||
*/
|
||||
#define USE_WINDOWS_LOCALE_API
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINDOWS_LOCALE_API
|
||||
#define USE_WINDOWS_LCID_MAPPING_API
|
||||
#include <windows.h>
|
||||
#include <winnls.h>
|
||||
#endif
|
||||
|
|
@ -53,8 +51,8 @@
|
|||
* The mapping from Win32 locale ID numbers to POSIX locale strings should
|
||||
* be the faster one.
|
||||
*
|
||||
* Many LCID values come from winnt.h
|
||||
* Some also come from http://www.microsoft.com/globaldev/reference/lcid-all.mspx
|
||||
* Windows LCIDs are defined at https://msdn.microsoft.com/en-us/library/cc233965.aspx
|
||||
* [MS-LCID] Windows Language Code Identifier (LCID) Reference
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
@ -126,7 +124,9 @@ static const ILcidPosixElement locmap_ ## id [] =
|
|||
// 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 National Lanaguage Support API Reference Website.
|
||||
// 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)
|
||||
|
|
@ -138,6 +138,9 @@ static const ILcidPosixElement locmap_ ## id [] =
|
|||
////////////////////////////////////////////
|
||||
*/
|
||||
|
||||
// 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) {
|
||||
|
|
@ -187,7 +190,10 @@ ILCID_POSIX_ELEMENT_ARRAY(0x0423, be, be_BY)
|
|||
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x0402, bg, bg_BG)
|
||||
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x0466, bin, bin_NG)
|
||||
ILCID_POSIX_SUBTABLE(bin) {
|
||||
{0x66, "bin"},
|
||||
{0x0466, "bin_NG"}
|
||||
};
|
||||
|
||||
ILCID_POSIX_SUBTABLE(bn) {
|
||||
{0x45, "bn"},
|
||||
|
|
@ -211,8 +217,15 @@ ILCID_POSIX_SUBTABLE(ca) {
|
|||
};
|
||||
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x0483, co, co_FR)
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x045c, chr,chr_US)
|
||||
|
||||
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"},
|
||||
|
|
@ -225,6 +238,7 @@ 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"},
|
||||
|
|
@ -239,6 +253,7 @@ ILCID_POSIX_SUBTABLE(de) {
|
|||
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"},
|
||||
|
|
@ -256,22 +271,23 @@ ILCID_POSIX_SUBTABLE(en) {
|
|||
{0x4809, "en_SG"},
|
||||
{0x2C09, "en_TT"},
|
||||
{0x0409, "en_US"},
|
||||
{0x007f, "en_US_POSIX"}, /* duplicate for roundtripping */
|
||||
{0x2409, "en_VI"}, /* Virgin Islands AKA Caribbean Islands (en_CB). */
|
||||
{0x007f, "en_US_POSIX"}, /* duplicate for round-tripping */
|
||||
{0x2409, "en_029"},
|
||||
{0x1c09, "en_ZA"},
|
||||
{0x3009, "en_ZW"},
|
||||
{0x2409, "en_029"},
|
||||
{0x0409, "en_AS"}, /* Alias for en_US. Leave last. */
|
||||
{0x0409, "en_GU"}, /* Alias for en_US. Leave last. */
|
||||
{0x0409, "en_MH"}, /* Alias for en_US. Leave last. */
|
||||
{0x0409, "en_MP"}, /* Alias for en_US. Leave last. */
|
||||
{0x0409, "en_UM"} /* Alias for en_US. Leave last. */
|
||||
{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"},
|
||||
|
|
@ -297,7 +313,7 @@ ILCID_POSIX_SUBTABLE(es) {
|
|||
{0x200a, "es_VE"},
|
||||
{0x580a, "es_419"},
|
||||
{0x040a, "es_ES@collation=traditional"},
|
||||
{0x040a, "es@collation=traditional"}
|
||||
{0x040a, "es@collation=traditional"} // Windows will treat this as es-ES@collation=traditional
|
||||
};
|
||||
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x0425, et, et_EE)
|
||||
|
|
@ -310,6 +326,7 @@ ILCID_POSIX_SUBTABLE(fa) {
|
|||
{0x048c, "fa_AF"} /* Persian/Dari (Afghanistan) */
|
||||
};
|
||||
|
||||
|
||||
/* duplicate for roundtripping */
|
||||
ILCID_POSIX_SUBTABLE(fa_AF) {
|
||||
{0x8c, "fa_AF"}, /* Persian/Dari (Afghanistan) */
|
||||
|
|
@ -411,7 +428,12 @@ ILCID_POSIX_SUBTABLE(hsb) {
|
|||
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x040e, hu, hu_HU)
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x042b, hy, hy_AM)
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x0469, ibb, ibb_NG)
|
||||
|
||||
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)
|
||||
|
|
@ -450,13 +472,18 @@ ILCID_POSIX_ELEMENT_ARRAY(0x0471, kr, kr_NG)
|
|||
|
||||
ILCID_POSIX_SUBTABLE(ks) { /* We could add PK and CN too */
|
||||
{0x60, "ks"},
|
||||
{0x0860, "ks_IN"}, /* Documentation doesn't mention script */
|
||||
{0x0460, "ks_Arab_IN"},
|
||||
{0x0860, "ks_Deva_IN"}
|
||||
};
|
||||
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x0440, ky, ky_KG) /* Kyrgyz is spoken in Kyrgyzstan */
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x0476, la, la_IT) /* TODO: Verify the country */
|
||||
|
||||
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)
|
||||
|
|
@ -501,8 +528,9 @@ ILCID_POSIX_SUBTABLE(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 */
|
||||
{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 */
|
||||
|
|
@ -526,15 +554,19 @@ ILCID_POSIX_SUBTABLE(or_IN) {
|
|||
{0x0448, "or_IN"},
|
||||
};
|
||||
|
||||
|
||||
ILCID_POSIX_SUBTABLE(pa) {
|
||||
{0x46, "pa"},
|
||||
{0x0446, "pa_IN"},
|
||||
{0x0846, "pa_PK"},
|
||||
{0x0846, "pa_Arab_PK"}
|
||||
{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(0x0479, pap, pap_AN)
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x0415, pl, pl_PL)
|
||||
ILCID_POSIX_ELEMENT_ARRAY(0x0463, ps, ps_AF)
|
||||
|
||||
|
|
@ -591,6 +623,9 @@ ILCID_POSIX_SUBTABLE(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"}
|
||||
};
|
||||
|
|
@ -607,9 +642,11 @@ ILCID_POSIX_ELEMENT_ARRAY(0x0485, sah,sah_RU)
|
|||
|
||||
ILCID_POSIX_SUBTABLE(sd) {
|
||||
{0x59, "sd"},
|
||||
{0x0459, "sd_IN"},
|
||||
{0x0459, "sd_Deva_IN"},
|
||||
{0x0859, "sd_PK"}
|
||||
{0x0459, "sd_IN"},
|
||||
{0x0859, "sd_Arab_PK"},
|
||||
{0x0859, "sd_PK"},
|
||||
{0x7c59, "sd_Arab"}
|
||||
};
|
||||
|
||||
ILCID_POSIX_SUBTABLE(se) {
|
||||
|
|
@ -633,9 +670,8 @@ 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) { /* TODO: Verify the country */
|
||||
ILCID_POSIX_SUBTABLE(so) {
|
||||
{0x77, "so"},
|
||||
{0x0477, "so_ET"},
|
||||
{0x0477, "so_SO"}
|
||||
};
|
||||
|
||||
|
|
@ -727,9 +763,16 @@ ILCID_POSIX_SUBTABLE(ve) { /* TODO: Verify the country */
|
|||
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_ELEMENT_ARRAY(0x043d, yi, yi)
|
||||
|
||||
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"},
|
||||
|
|
@ -753,6 +796,7 @@ ILCID_POSIX_SUBTABLE(zh) {
|
|||
{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)
|
||||
|
|
@ -971,7 +1015,7 @@ static const char*
|
|||
getPosixID(const ILcidPosixMap *this_0, uint32_t hostID)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i <= this_0->numRegions; i++)
|
||||
for (i = 0; i < this_0->numRegions; i++)
|
||||
{
|
||||
if (this_0->regionMaps[i].hostID == hostID)
|
||||
{
|
||||
|
|
@ -991,7 +1035,7 @@ getPosixID(const ILcidPosixMap *this_0, uint32_t hostID)
|
|||
//
|
||||
/////////////////////////////////////
|
||||
*/
|
||||
#ifdef USE_WINDOWS_LOCALE_API
|
||||
#ifdef USE_WINDOWS_LCID_MAPPING_API
|
||||
/*
|
||||
* Various language tags needs to be changed:
|
||||
* quz -> qu
|
||||
|
|
@ -1017,43 +1061,57 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
|
|||
UBool bLookup = TRUE;
|
||||
const char *pPosixID = NULL;
|
||||
|
||||
#ifdef USE_WINDOWS_LOCALE_API
|
||||
#ifdef USE_WINDOWS_LCID_MAPPING_API
|
||||
char locName[LOCALE_NAME_MAX_LENGTH] = {}; // ICU name can't be longer than Windows name
|
||||
|
||||
// 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;
|
||||
char locName[157]; /* ULOC_FULLNAME_CAPACITY */
|
||||
UChar windowsLocaleName[LOCALE_NAME_MAX_LENGTH]; // ULOC_FULLNAME_CAPACITY > LOCALE_NAME_MAX_LENGTH
|
||||
|
||||
tmpLen = GetLocaleInfoA(hostid, LOCALE_SNAME, (LPSTR)locName, UPRV_LENGTHOF(locName));
|
||||
// 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) {
|
||||
/* Windows locale name may contain sorting variant, such as "es-ES_tradnl".
|
||||
In such case, we need special mapping data found in the hardcoded table
|
||||
in this source file. */
|
||||
char *p = uprv_strchr(locName, '_');
|
||||
if (p) {
|
||||
/* Keep the base locale, without variant */
|
||||
*p = 0;
|
||||
tmpLen = uprv_strlen(locName);
|
||||
}
|
||||
else {
|
||||
/* No hardcoded table lookup necessary */
|
||||
bLookup = FALSE;
|
||||
}
|
||||
/* Change the tag separator from '-' to '_' */
|
||||
p = locName;
|
||||
while (*p) {
|
||||
if (*p == '-') {
|
||||
*p = '_';
|
||||
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;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
// TODO: Need to understand this better, why isn't it an alias?
|
||||
FIX_LANGUAGE_ID_TAG(locName, tmpLen);
|
||||
pPosixID = locName;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // USE_WINDOWS_LCID_MAPPING_API
|
||||
|
||||
if (bLookup) {
|
||||
const char *pCandidate = NULL;
|
||||
langID = LANGUAGE_LCID(hostid);
|
||||
|
|
@ -1074,7 +1132,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
|
|||
}
|
||||
|
||||
if (pPosixID) {
|
||||
int32_t resLen = uprv_strlen(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) {
|
||||
|
|
@ -1101,15 +1159,103 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
|
|||
// POSIX --> LCID
|
||||
// This should only be called from uloc_getLCID.
|
||||
// The locale ID must be in canonical form.
|
||||
// langID is separate so that this file doesn't depend on the uloc_* API.
|
||||
//
|
||||
/////////////////////////////////////
|
||||
*/
|
||||
U_CAPI uint32_t
|
||||
uprv_convertToLCIDPlatform(const char* localeID)
|
||||
{
|
||||
// The purpose of this function is to leverage native platform name->lcid
|
||||
// conversion functionality when available.
|
||||
#ifdef USE_WINDOWS_LCID_MAPPING_API
|
||||
DWORD nameLCIDFlags = 0;
|
||||
UErrorCode myStatus = U_ZERO_ERROR;
|
||||
|
||||
// First check for a Windows name->LCID match, fall through to catch
|
||||
// ICU special cases, but Windows may know it already.
|
||||
#if LOCALE_ALLOW_NEUTRAL_NAMES
|
||||
nameLCIDFlags = LOCALE_ALLOW_NEUTRAL_NAMES;
|
||||
#endif /* LOCALE_ALLOW_NEUTRAL_NAMES */
|
||||
|
||||
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, &myStatus);
|
||||
if (U_SUCCESS(myStatus) && 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, &myStatus);
|
||||
|
||||
if (U_SUCCESS(myStatus) && 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, &myStatus);
|
||||
|
||||
if (U_SUCCESS(myStatus))
|
||||
{
|
||||
// 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, nameLCIDFlags);
|
||||
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 /* USE_WINDOWS_LCID_MAPPING_API */
|
||||
|
||||
// No found, or not implemented on platforms without native name->lcid conversion
|
||||
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;
|
||||
|
|
@ -1172,4 +1318,3 @@ uprv_convertToLCID(const char *langID, const char* posixID, UErrorCode* status)
|
|||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0; /* return international (root) */
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,8 @@
|
|||
|
||||
U_CAPI int32_t uprv_convertToPosix(uint32_t hostid, char* posixID, int32_t posixIDCapacity, UErrorCode* status);
|
||||
|
||||
/* Don't call this function directly. Use uloc_getLCID instead. */
|
||||
/* Don't call these functions directly. Use uloc_getLCID instead. */
|
||||
U_CAPI uint32_t uprv_convertToLCIDPlatform(const char *localeID); // Leverage platform conversion if possible
|
||||
U_CAPI uint32_t uprv_convertToLCID(const char *langID, const char* posixID, UErrorCode* status);
|
||||
|
||||
#endif /* LOCMAP_H */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/**
|
||||
*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,9 +34,9 @@ U_NAMESPACE_BEGIN
|
|||
// private mutex where possible.
|
||||
|
||||
// For example:
|
||||
//
|
||||
// UMutex myMutex;
|
||||
//
|
||||
//
|
||||
// UMutex myMutex = U_MUTEX_INITIALIZER;
|
||||
//
|
||||
// void Function(int arg1, int arg2)
|
||||
// {
|
||||
// static Object* foo; // Shared read-write object
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright (C) 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.
|
||||
*******************************************************************************
|
||||
* loadednormalizer2impl.h
|
||||
* norm2allmodes.h
|
||||
*
|
||||
* created on: 2014sep07
|
||||
* created by: Markus W. Scherer
|
||||
|
|
@ -18,7 +18,9 @@
|
|||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
#include "unicode/edits.h"
|
||||
#include "unicode/normalizer2.h"
|
||||
#include "unicode/stringoptions.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "cpputils.h"
|
||||
#include "normalizer2impl.h"
|
||||
|
|
@ -210,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.hasDecompBoundary(c, TRUE); }
|
||||
virtual UBool hasBoundaryAfter(UChar32 c) const { return impl.hasDecompBoundary(c, FALSE); }
|
||||
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); }
|
||||
};
|
||||
|
||||
|
|
@ -224,19 +226,35 @@ public:
|
|||
private:
|
||||
virtual void
|
||||
normalize(const UChar *src, const UChar *limit,
|
||||
ReorderingBuffer &buffer, UErrorCode &errorCode) const {
|
||||
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();
|
||||
}
|
||||
|
||||
virtual void
|
||||
normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize,
|
||||
UnicodeString &safeMiddle,
|
||||
ReorderingBuffer &buffer, UErrorCode &errorCode) const {
|
||||
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 {
|
||||
isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -252,8 +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 UNormalizationCheckResult
|
||||
quickCheck(const UnicodeString &s, UErrorCode &errorCode) const {
|
||||
quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return UNORM_MAYBE;
|
||||
}
|
||||
|
|
@ -267,21 +293,21 @@ private:
|
|||
return qcResult;
|
||||
}
|
||||
virtual const UChar *
|
||||
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &) const {
|
||||
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 {
|
||||
virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE {
|
||||
return impl.getCompQuickCheck(impl.getNorm16(c));
|
||||
}
|
||||
virtual UBool hasBoundaryBefore(UChar32 c) const {
|
||||
virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE {
|
||||
return impl.hasCompBoundaryBefore(c);
|
||||
}
|
||||
virtual UBool hasBoundaryAfter(UChar32 c) const {
|
||||
return impl.hasCompBoundaryAfter(c, onlyContiguous, FALSE);
|
||||
virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE {
|
||||
return impl.hasCompBoundaryAfter(c, onlyContiguous);
|
||||
}
|
||||
virtual UBool isInert(UChar32 c) const {
|
||||
return impl.hasCompBoundaryAfter(c, onlyContiguous, TRUE);
|
||||
virtual UBool isInert(UChar32 c) const U_OVERRIDE {
|
||||
return impl.isCompInert(c, onlyContiguous);
|
||||
}
|
||||
|
||||
const UBool onlyContiguous;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -20,7 +20,9 @@
|
|||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
#include "unicode/edits.h"
|
||||
#include "unicode/normalizer2.h"
|
||||
#include "unicode/stringoptions.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/unorm.h"
|
||||
#include "cstring.h"
|
||||
|
|
@ -32,9 +34,11 @@
|
|||
|
||||
using icu::Normalizer2Impl;
|
||||
|
||||
#if NORM2_HARDCODE_NFC_DATA
|
||||
// NFC/NFD data machine-generated by gennorm2 --csource
|
||||
#define INCLUDED_FROM_NORMALIZER2_CPP
|
||||
#include "norm2_nfc_data.h"
|
||||
#endif
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
|
|
@ -42,6 +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);
|
||||
}
|
||||
|
||||
UBool
|
||||
Normalizer2::getRawDecomposition(UChar32, UnicodeString &) const {
|
||||
return FALSE;
|
||||
|
|
@ -57,6 +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);
|
||||
}
|
||||
|
||||
// Normalizer2 implementation for the old UNORM_NONE.
|
||||
class NoopNormalizer2 : public Normalizer2 {
|
||||
virtual ~NoopNormalizer2();
|
||||
|
|
@ -64,7 +87,7 @@ class NoopNormalizer2 : public Normalizer2 {
|
|||
virtual UnicodeString &
|
||||
normalize(const UnicodeString &src,
|
||||
UnicodeString &dest,
|
||||
UErrorCode &errorCode) const {
|
||||
UErrorCode &errorCode) const U_OVERRIDE {
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
if(&dest!=&src) {
|
||||
dest=src;
|
||||
|
|
@ -74,10 +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 UnicodeString &
|
||||
normalizeSecondAndAppend(UnicodeString &first,
|
||||
const UnicodeString &second,
|
||||
UErrorCode &errorCode) const {
|
||||
UErrorCode &errorCode) const U_OVERRIDE {
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
if(&first!=&second) {
|
||||
first.append(second);
|
||||
|
|
@ -90,7 +130,7 @@ class NoopNormalizer2 : public Normalizer2 {
|
|||
virtual UnicodeString &
|
||||
append(UnicodeString &first,
|
||||
const UnicodeString &second,
|
||||
UErrorCode &errorCode) const {
|
||||
UErrorCode &errorCode) const U_OVERRIDE {
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
if(&first!=&second) {
|
||||
first.append(second);
|
||||
|
|
@ -101,25 +141,29 @@ class NoopNormalizer2 : public Normalizer2 {
|
|||
return first;
|
||||
}
|
||||
virtual UBool
|
||||
getDecomposition(UChar32, UnicodeString &) const {
|
||||
getDecomposition(UChar32, UnicodeString &) const U_OVERRIDE {
|
||||
return FALSE;
|
||||
}
|
||||
// No need to override the default getRawDecomposition().
|
||||
// No need to U_OVERRIDE the default getRawDecomposition().
|
||||
virtual UBool
|
||||
isNormalized(const UnicodeString &, UErrorCode &) const {
|
||||
return TRUE;
|
||||
isNormalized(const UnicodeString &, 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 {
|
||||
quickCheck(const UnicodeString &, UErrorCode &) const U_OVERRIDE {
|
||||
return UNORM_YES;
|
||||
}
|
||||
virtual int32_t
|
||||
spanQuickCheckYes(const UnicodeString &s, UErrorCode &) const {
|
||||
spanQuickCheckYes(const UnicodeString &s, UErrorCode &) const U_OVERRIDE {
|
||||
return s.length();
|
||||
}
|
||||
virtual UBool hasBoundaryBefore(UChar32) const { return TRUE; }
|
||||
virtual UBool hasBoundaryAfter(UChar32) const { return TRUE; }
|
||||
virtual UBool isInert(UChar32) const { 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() {}
|
||||
|
|
@ -134,6 +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;
|
||||
}
|
||||
|
||||
Norm2AllModes::~Norm2AllModes() {
|
||||
delete impl;
|
||||
}
|
||||
|
|
@ -153,6 +227,7 @@ Norm2AllModes::createInstance(Normalizer2Impl *impl, UErrorCode &errorCode) {
|
|||
return allModes;
|
||||
}
|
||||
|
||||
#if NORM2_HARDCODE_NFC_DATA
|
||||
Norm2AllModes *
|
||||
Norm2AllModes::createNFCInstance(UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
|
|
@ -168,48 +243,15 @@ Norm2AllModes::createNFCInstance(UErrorCode &errorCode) {
|
|||
return createInstance(impl, errorCode);
|
||||
}
|
||||
|
||||
U_CDECL_BEGIN
|
||||
static UBool U_CALLCONV uprv_normalizer2_cleanup();
|
||||
U_CDECL_END
|
||||
|
||||
static Norm2AllModes *nfcSingleton;
|
||||
static Normalizer2 *noopSingleton;
|
||||
|
||||
static icu::UInitOnce nfcInitOnce = U_INITONCE_INITIALIZER;
|
||||
static icu::UInitOnce noopInitOnce = U_INITONCE_INITIALIZER;
|
||||
|
||||
// UInitOnce singleton initialization functions
|
||||
static void U_CALLCONV initNFCSingleton(UErrorCode &errorCode) {
|
||||
nfcSingleton=Norm2AllModes::createNFCInstance(errorCode);
|
||||
ucln_common_registerCleanup(UCLN_COMMON_NORMALIZER2, uprv_normalizer2_cleanup);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
||||
static UBool U_CALLCONV uprv_normalizer2_cleanup() {
|
||||
delete nfcSingleton;
|
||||
nfcSingleton = NULL;
|
||||
delete noopSingleton;
|
||||
noopSingleton = NULL;
|
||||
nfcInitOnce.reset();
|
||||
noopInitOnce.reset();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
const Norm2AllModes *
|
||||
Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) { return NULL; }
|
||||
|
|
@ -239,23 +281,29 @@ const Normalizer2 *Normalizer2Factory::getFCCInstance(UErrorCode &errorCode) {
|
|||
return allModes!=NULL ? &allModes->fcc : NULL;
|
||||
}
|
||||
|
||||
const Normalizer2 *Normalizer2Factory::getNoopInstance(UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) { return NULL; }
|
||||
umtx_initOnce(noopInitOnce, &initNoopSingleton, errorCode);
|
||||
return noopSingleton;
|
||||
}
|
||||
|
||||
const Normalizer2Impl *
|
||||
Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? allModes->impl : NULL;
|
||||
}
|
||||
#endif // NORM2_HARDCODE_NFC_DATA
|
||||
|
||||
const Normalizer2Impl *
|
||||
Normalizer2Factory::getImpl(const Normalizer2 *norm2) {
|
||||
return &((Normalizer2WithImpl *)norm2)->impl;
|
||||
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_NAMESPACE_END
|
||||
|
||||
// C API ------------------------------------------------------------------- ***
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -24,17 +24,30 @@
|
|||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
#include "unicode/normalizer2.h"
|
||||
#include "unicode/ucptrie.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/unorm.h"
|
||||
#include "unicode/utf.h"
|
||||
#include "unicode/utf16.h"
|
||||
#include "mutex.h"
|
||||
#include "udataswp.h"
|
||||
#include "uset_imp.h"
|
||||
#include "utrie2.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
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
struct CanonIterData;
|
||||
|
||||
class ByteSink;
|
||||
class Edits;
|
||||
class InitCanonIterData;
|
||||
class LcccContext;
|
||||
|
||||
class U_COMMON_API Hangul {
|
||||
public:
|
||||
/* Korean Hangul and Jamo constants */
|
||||
|
|
@ -63,9 +76,9 @@ public:
|
|||
return HANGUL_BASE<=c && c<HANGUL_LIMIT;
|
||||
}
|
||||
static inline UBool
|
||||
isHangulWithoutJamoT(UChar c) {
|
||||
isHangulLV(UChar32 c) {
|
||||
c-=HANGUL_BASE;
|
||||
return 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;
|
||||
|
|
@ -73,6 +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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decomposes c, which must be a Hangul syllable, into buffer
|
||||
|
|
@ -105,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]=orig-c2; // LV syllable
|
||||
buffer[0]=(UChar)(orig-c2); // LV syllable
|
||||
buffer[1]=(UChar)(JAMO_T_BASE+c2);
|
||||
}
|
||||
}
|
||||
|
|
@ -117,10 +138,13 @@ class Normalizer2Impl;
|
|||
|
||||
class U_COMMON_API ReorderingBuffer : public UMemory {
|
||||
public:
|
||||
/** 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);
|
||||
~ReorderingBuffer() {
|
||||
if(start!=NULL) {
|
||||
str.releaseBuffer((int32_t)(limit-start));
|
||||
|
|
@ -135,19 +159,14 @@ public:
|
|||
uint8_t getLastCC() const { return lastCC; }
|
||||
|
||||
UBool equals(const UChar *start, const UChar *limit) const;
|
||||
|
||||
// For Hangul composition, replacing the Leading consonant Jamo with the syllable.
|
||||
void setLastChar(UChar c) {
|
||||
*(limit-1)=c;
|
||||
}
|
||||
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);
|
||||
}
|
||||
// s must be in NFD, otherwise change the implementation.
|
||||
UBool append(const UChar *s, int32_t length,
|
||||
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) {
|
||||
|
|
@ -176,7 +195,7 @@ public:
|
|||
lastCC=0;
|
||||
}
|
||||
void copyReorderableSuffixTo(UnicodeString &s) const {
|
||||
s.setTo(reorderStart, (int32_t)(limit-reorderStart));
|
||||
s.setTo(ConstChar16Ptr(reorderStart), (int32_t)(limit-reorderStart));
|
||||
}
|
||||
private:
|
||||
/*
|
||||
|
|
@ -218,6 +237,12 @@ 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
|
||||
*/
|
||||
class U_COMMON_API Normalizer2Impl : public UObject {
|
||||
public:
|
||||
Normalizer2Impl() : normTrie(NULL), fCanonIterData(NULL) {
|
||||
|
|
@ -225,7 +250,7 @@ public:
|
|||
}
|
||||
virtual ~Normalizer2Impl();
|
||||
|
||||
void init(const int32_t *inIndexes, const UTrie2 *inTrie,
|
||||
void init(const int32_t *inIndexes, const UCPTrie *inTrie,
|
||||
const uint16_t *inExtraData, const uint8_t *inSmallFCD);
|
||||
|
||||
void addLcccChars(UnicodeSet &set) const;
|
||||
|
|
@ -234,11 +259,14 @@ public:
|
|||
|
||||
// low-level properties ------------------------------------------------ ***
|
||||
|
||||
const UTrie2 *getNormTrie() const { return normTrie; }
|
||||
|
||||
UBool ensureCanonIterData(UErrorCode &errorCode) const;
|
||||
|
||||
uint16_t getNorm16(UChar32 c) const { return UTRIE2_GET16(normTrie, 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) ? 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) {
|
||||
|
|
@ -255,15 +283,22 @@ public:
|
|||
|
||||
uint8_t getCC(uint16_t norm16) const {
|
||||
if(norm16>=MIN_NORMAL_MAYBE_YES) {
|
||||
return (uint8_t)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 getCCFromYesOrMaybe(uint16_t norm16) {
|
||||
return norm16>=MIN_NORMAL_MAYBE_YES ? (uint8_t)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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -272,10 +307,8 @@ public:
|
|||
* @return The lccc(c) in bits 15..8 and tccc(c) in bits 7..0.
|
||||
*/
|
||||
uint16_t getFCD16(UChar32 c) const {
|
||||
if(c<0) {
|
||||
if(c<minDecompNoCP) {
|
||||
return 0;
|
||||
} else if(c<0x180) {
|
||||
return tccc180[c];
|
||||
} else if(c<=0xffff) {
|
||||
if(!singleLeadMightHaveNonZeroFCD16(c)) { return 0; }
|
||||
}
|
||||
|
|
@ -291,9 +324,7 @@ public:
|
|||
*/
|
||||
uint16_t nextFCD16(const UChar *&s, const UChar *limit) const {
|
||||
UChar32 c=*s++;
|
||||
if(c<0x180) {
|
||||
return tccc180[c];
|
||||
} else if(!singleLeadMightHaveNonZeroFCD16(c)) {
|
||||
if(c<minDecompNoCP || !singleLeadMightHaveNonZeroFCD16(c)) {
|
||||
return 0;
|
||||
}
|
||||
UChar c2;
|
||||
|
|
@ -311,8 +342,8 @@ public:
|
|||
*/
|
||||
uint16_t previousFCD16(const UChar *start, const UChar *&s) const {
|
||||
UChar32 c=*--s;
|
||||
if(c<0x180) {
|
||||
return tccc180[c];
|
||||
if(c<minDecompNoCP) {
|
||||
return 0;
|
||||
}
|
||||
if(!U16_IS_TRAIL(c)) {
|
||||
if(!singleLeadMightHaveNonZeroFCD16(c)) {
|
||||
|
|
@ -328,8 +359,6 @@ public:
|
|||
return getFCD16FromNormData(c);
|
||||
}
|
||||
|
||||
/** Returns the FCD data for U+0000<=c<U+0180. */
|
||||
uint16_t getFCD16FromBelow180(UChar32 c) const { return tccc180[c]; }
|
||||
/** Returns TRUE if the single-or-lead code unit c might have non-zero FCD data. */
|
||||
UBool singleLeadMightHaveNonZeroFCD16(UChar32 lead) const {
|
||||
// 0<=lead<=0xffff
|
||||
|
|
@ -340,9 +369,6 @@ public:
|
|||
/** Returns the FCD value from the regular normalization data. */
|
||||
uint16_t getFCD16FromNormData(UChar32 c) const;
|
||||
|
||||
void makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, uint16_t norm16,
|
||||
CanonIterData &newData, UErrorCode &errorCode) const;
|
||||
|
||||
/**
|
||||
* Gets the decomposition for one code point.
|
||||
* @param c code point
|
||||
|
|
@ -367,14 +393,25 @@ public:
|
|||
UBool getCanonStartSet(UChar32 c, UnicodeSet &set) const;
|
||||
|
||||
enum {
|
||||
MIN_CCC_LCCC_CP=0x300
|
||||
};
|
||||
// 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,
|
||||
|
||||
enum {
|
||||
MIN_YES_YES_WITH_CC=0xff01,
|
||||
JAMO_VT=0xff00,
|
||||
MIN_NORMAL_MAYBE_YES=0xfe00,
|
||||
JAMO_L=1,
|
||||
MAX_DELTA=0x40
|
||||
};
|
||||
|
||||
|
|
@ -394,21 +431,32 @@ public:
|
|||
IX_MIN_COMP_NO_MAYBE_CP,
|
||||
|
||||
// Norm16 value thresholds for quick check combinations and types of extra data.
|
||||
IX_MIN_YES_NO, // Mappings & compositions in [minYesNo..minYesNoMappingsOnly[.
|
||||
|
||||
/** 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,
|
||||
|
||||
IX_MIN_YES_NO_MAPPINGS_ONLY, // Mappings only in [minYesNoMappingsOnly..minNoNo[.
|
||||
/** 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_RESERVED15,
|
||||
IX_MIN_LCCC_CP,
|
||||
IX_RESERVED19,
|
||||
IX_COUNT
|
||||
};
|
||||
|
||||
enum {
|
||||
MAPPING_HAS_CCC_LCCC_WORD=0x80,
|
||||
MAPPING_HAS_RAW_MAPPING=0x40,
|
||||
MAPPING_NO_COMP_BOUNDARY_AFTER=0x20,
|
||||
// unused bit 0x20,
|
||||
MAPPING_LENGTH_MASK=0x1f
|
||||
};
|
||||
|
||||
|
|
@ -457,6 +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;
|
||||
|
||||
const UChar *makeFCD(const UChar *src, const UChar *limit,
|
||||
ReorderingBuffer *buffer, UErrorCode &errorCode) const;
|
||||
void makeFCDAndAppend(const UChar *src, const UChar *limit,
|
||||
|
|
@ -465,27 +519,42 @@ public:
|
|||
ReorderingBuffer &buffer,
|
||||
UErrorCode &errorCode) const;
|
||||
|
||||
UBool hasDecompBoundary(UChar32 c, UBool before) 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 || hasCompBoundaryBefore(c, getNorm16(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 hasCompBoundaryAfter(UChar32 c, UBool onlyContiguous, UBool testInert) const;
|
||||
|
||||
UBool hasFCDBoundaryBefore(UChar32 c) const { return c<MIN_CCC_LCCC_CP || getFCD16(c)<=0xff; }
|
||||
UBool hasFCDBoundaryAfter(UChar32 c) const {
|
||||
uint16_t fcd16=getFCD16(c);
|
||||
return fcd16<=1 || (fcd16&0xff)==0;
|
||||
}
|
||||
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;
|
||||
|
||||
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==0; }
|
||||
static UBool isJamoL(uint16_t norm16) { return norm16==1; }
|
||||
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; }
|
||||
UBool isHangul(uint16_t norm16) const { return norm16==minYesNo; }
|
||||
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;
|
||||
|
|
@ -504,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 5.2 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;
|
||||
|
|
@ -514,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 ? (uint8_t)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);
|
||||
|
|
@ -525,30 +594,47 @@ private:
|
|||
}
|
||||
}
|
||||
// requires that the [cpStart..cpLimit[ character passes isCompYesAndZeroCC()
|
||||
uint8_t getTrailCCFromCompYesAndZeroCC(const UChar *cpStart, const UChar *cpLimit) 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-(minMaybeYes-MAX_DELTA-1);
|
||||
return c+(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; }
|
||||
const uint16_t *getMapping(uint16_t norm16) const { return extraData+(norm16>>OFFSET_SHIFT); }
|
||||
const uint16_t *getCompositionsListForDecompYes(uint16_t norm16) const {
|
||||
if(norm16==0 || MIN_NORMAL_MAYBE_YES<=norm16) {
|
||||
if(norm16<JAMO_L || MIN_NORMAL_MAYBE_YES<=norm16) {
|
||||
return NULL;
|
||||
} else if(norm16<minMaybeYes) {
|
||||
return extraData+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 {
|
||||
const uint16_t *list=extraData+norm16; // composite has both mapping & compositions list
|
||||
// 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 lenth
|
||||
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);
|
||||
}
|
||||
/**
|
||||
* @param c code point must have compositions
|
||||
* @return compositions list pointer
|
||||
|
|
@ -563,46 +649,78 @@ private:
|
|||
UChar32 minNeedDataCP,
|
||||
ReorderingBuffer *buffer,
|
||||
UErrorCode &errorCode) const;
|
||||
UBool decomposeShort(const UChar *src, const UChar *limit,
|
||||
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;
|
||||
|
||||
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;
|
||||
const UChar *findPreviousCompBoundary(const UChar *start, const UChar *p) const;
|
||||
const UChar *findNextCompBoundary(const UChar *p, const UChar *limit) 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;
|
||||
|
||||
int32_t getCanonValue(UChar32 c) const;
|
||||
const UnicodeSet &getCanonStartSet(int32_t n) const;
|
||||
|
||||
// UVersionInfo dataVersion;
|
||||
|
||||
// Code point thresholds for quick check codes.
|
||||
UChar32 minDecompNoCP;
|
||||
UChar32 minCompNoMaybeCP;
|
||||
// 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 limitNoNo;
|
||||
uint16_t centerNoNoDelta;
|
||||
uint16_t minMaybeYes;
|
||||
|
||||
const UTrie2 *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
|
||||
uint8_t tccc180[0x180]; // tccc values for U+0000..U+017F
|
||||
|
||||
public: // CanonIterData is public to allow access from C callback functions.
|
||||
UInitOnce fCanonIterDataInitOnce;
|
||||
CanonIterData *fCanonIterData;
|
||||
};
|
||||
|
|
@ -658,13 +776,14 @@ unorm_getFCD16(UChar32 c);
|
|||
|
||||
/**
|
||||
* Format of Normalizer2 .nrm data files.
|
||||
* Format version 2.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.
|
||||
*
|
||||
* Normalizer2.getInstance() causes a .nrm file to be loaded, unless it has been
|
||||
* cached already. Internally, Normalizer2Impl.load() reads the .nrm file.
|
||||
|
|
@ -695,27 +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.
|
||||
*
|
||||
* The next five 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.
|
||||
* minYesNo=indexes[IX_MIN_YES_NO];
|
||||
* 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];
|
||||
* limitNoNo=indexes[IX_LIMIT_NO_NO];
|
||||
* minMaybeYes=indexes[IX_MIN_MAYBE_YES];
|
||||
* minYesNoMappingsOnly=indexes[IX_MIN_YES_NO_MAPPINGS_ONLY];
|
||||
* See the normTrie description below and the design doc for details.
|
||||
*
|
||||
* UTrie2 normTrie; -- see utrie2_impl.h and utrie2.h
|
||||
* 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().
|
||||
* 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==0 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.
|
||||
|
|
@ -729,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 0.
|
||||
* 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.
|
||||
*
|
||||
|
|
@ -738,6 +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.
|
||||
*
|
||||
* The maybeYesCompositions array contains compositions lists for characters that
|
||||
* combine both forward (as starters in composition pairs)
|
||||
|
|
@ -754,6 +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.
|
||||
*
|
||||
* The data structures for compositions lists and mappings are described in the design doc.
|
||||
*
|
||||
|
|
@ -784,6 +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.
|
||||
*/
|
||||
|
||||
#endif /* !UCONFIG_NO_NORMALIZATION */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,6 +23,12 @@
|
|||
#include "normalizer2impl.h"
|
||||
#include "uprops.h" // for uniset_getUnicode32Instance()
|
||||
|
||||
#if defined(_ARM64_) && 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)
|
||||
|
|
@ -40,7 +46,7 @@ Normalizer::Normalizer(const UnicodeString& str, UNormalizationMode mode) :
|
|||
init();
|
||||
}
|
||||
|
||||
Normalizer::Normalizer(const UChar *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),
|
||||
|
|
@ -435,7 +441,7 @@ Normalizer::setText(const CharacterIterator& newText,
|
|||
}
|
||||
|
||||
void
|
||||
Normalizer::setText(const UChar* newText,
|
||||
Normalizer::setText(ConstChar16Ptr newText,
|
||||
int32_t length,
|
||||
UErrorCode &status)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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 diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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.c
|
||||
* encoding: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -499,6 +499,8 @@ 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);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,8 +43,24 @@
|
|||
// Must be before any other #includes.
|
||||
#include "uposixdefs.h"
|
||||
|
||||
/* include ICU headers */
|
||||
#include "unicode/utypes.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 */
|
||||
#include "unicode/putil.h"
|
||||
#include "unicode/ustring.h"
|
||||
#include "putilimp.h"
|
||||
|
|
@ -76,14 +92,28 @@
|
|||
* Should Cygwin be included as well (U_PLATFORM_HAS_WIN32_API)
|
||||
* to use native APIs as much as possible?
|
||||
*/
|
||||
#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>
|
||||
# include "unicode/uloc.h"
|
||||
# include "wintz.h"
|
||||
#if U_PLATFORM_HAS_WINUWP_API
|
||||
typedef PVOID LPMSG; // TODO: figure out how to get rid of this typedef
|
||||
#include <Windows.Globalization.h>
|
||||
#include <windows.system.userprofile.h>
|
||||
#include <wrl/wrappers/corewrappers.h>
|
||||
#include <wrl/client.h>
|
||||
|
||||
using namespace ABI::Windows::Foundation;
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
#endif
|
||||
#elif U_PLATFORM == U_PF_OS400
|
||||
# include <float.h>
|
||||
# include <qusec.h> /* error code structure */
|
||||
|
|
@ -104,20 +134,6 @@
|
|||
# include <sys/neutrino.h>
|
||||
#endif
|
||||
|
||||
#if (U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__)
|
||||
/* tzset isn't defined in strict ANSI on Cygwin and 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
|
||||
|
||||
/*
|
||||
* Only include langinfo.h if we have a way to get the codeset. If we later
|
||||
* depend on more feature, we can test on U_HAVE_NL_LANGINFO.
|
||||
|
|
@ -516,6 +532,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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncates the given double.
|
||||
* trunc(3.3) = 3.0, trunc (-3.3) = -3.0
|
||||
|
|
@ -651,13 +689,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 || (U_PLATFORM == U_PF_CYGWIN && !U_PLATFORM_USES_ONLY_WIN32_API))
|
||||
#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.
|
||||
*/
|
||||
|
||||
#define CHECK_LOCALTIME_LINK 1
|
||||
#if U_PLATFORM_IS_DARWIN_BASED
|
||||
#include <tzfile.h>
|
||||
|
|
@ -665,12 +713,12 @@ extern U_IMPORT char *U_TZNAME[];
|
|||
#elif U_PLATFORM == U_PF_SOLARIS
|
||||
#define TZDEFAULT "/etc/localtime"
|
||||
#define TZZONEINFO "/usr/share/lib/zoneinfo/"
|
||||
#define TZZONEINFO2 "../usr/share/lib/zoneinfo/"
|
||||
#define TZ_ENV_CHECK "localtime"
|
||||
#else
|
||||
#define TZDEFAULT "/etc/localtime"
|
||||
#define TZZONEINFO "/usr/share/zoneinfo/"
|
||||
#endif
|
||||
#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
|
||||
|
|
@ -922,30 +970,30 @@ 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 = opendir(path);
|
||||
DIR* subDirp = 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);
|
||||
if (dirp == NULL) {
|
||||
return result;
|
||||
goto cleanupAndReturn;
|
||||
}
|
||||
|
||||
if (gSearchTZFileResult == NULL) {
|
||||
gSearchTZFileResult = new CharString;
|
||||
if (gSearchTZFileResult == NULL) {
|
||||
return NULL;
|
||||
goto cleanupAndReturn;
|
||||
}
|
||||
ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
|
||||
}
|
||||
|
||||
/* Save the current path */
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
CharString curpath(path, -1, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check each entry in the directory. */
|
||||
while((dirEntry = readdir(dirp)) != NULL) {
|
||||
const char* dirName = dirEntry->d_name;
|
||||
|
|
@ -954,15 +1002,16 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
|
|||
CharString newpath(curpath, status);
|
||||
newpath.append(dirName, -1, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
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)) {
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
result = searchForTZFile(newpath.data(), tzInfo);
|
||||
/*
|
||||
|
|
@ -986,7 +1035,7 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
|
|||
gSearchTZFileResult->clear();
|
||||
gSearchTZFileResult->append(zoneid, -1, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
result = gSearchTZFileResult->data();
|
||||
/* Get out after the first one found. */
|
||||
|
|
@ -995,7 +1044,11 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
|
|||
}
|
||||
}
|
||||
}
|
||||
closedir(dirp);
|
||||
|
||||
cleanupAndReturn:
|
||||
if (dirp) {
|
||||
closedir(dirp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1011,6 +1064,7 @@ uprv_tzname_clear_cache()
|
|||
U_CAPI const char* U_EXPORT2
|
||||
uprv_tzname(int n)
|
||||
{
|
||||
(void)n; // Avoid unreferenced parameter warning.
|
||||
const char *tzid = NULL;
|
||||
#if U_PLATFORM_USES_ONLY_WIN32_API
|
||||
tzid = uprv_detectWindowsTimeZone();
|
||||
|
|
@ -1018,6 +1072,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("Etc/UTC");
|
||||
#endif // !U_TZNAME
|
||||
|
||||
#else
|
||||
|
||||
/*#if U_PLATFORM_IS_DARWIN_BASED
|
||||
|
|
@ -1059,24 +1122,15 @@ uprv_tzname(int n)
|
|||
*/
|
||||
int32_t ret = (int32_t)readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer)-1);
|
||||
if (0 < ret) {
|
||||
int32_t tzZoneInfoLen = uprv_strlen(TZZONEINFO);
|
||||
int32_t tzZoneInfoTailLen = uprv_strlen(TZZONEINFOTAIL);
|
||||
gTimeZoneBuffer[ret] = 0;
|
||||
if (uprv_strncmp(gTimeZoneBuffer, TZZONEINFO, tzZoneInfoLen) == 0
|
||||
&& isValidOlsonID(gTimeZoneBuffer + tzZoneInfoLen))
|
||||
char * tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
|
||||
|
||||
if (tzZoneInfoTailPtr != NULL
|
||||
&& isValidOlsonID(tzZoneInfoTailPtr + tzZoneInfoTailLen))
|
||||
{
|
||||
return (gTimeZoneBufferPtr = gTimeZoneBuffer + tzZoneInfoLen);
|
||||
return (gTimeZoneBufferPtr = tzZoneInfoTailPtr + tzZoneInfoTailLen);
|
||||
}
|
||||
#if U_PLATFORM == U_PF_SOLARIS
|
||||
else
|
||||
{
|
||||
tzZoneInfoLen = uprv_strlen(TZZONEINFO2);
|
||||
if (uprv_strncmp(gTimeZoneBuffer, TZZONEINFO2, tzZoneInfoLen) == 0
|
||||
&& isValidOlsonID(gTimeZoneBuffer + tzZoneInfoLen))
|
||||
{
|
||||
return (gTimeZoneBufferPtr = gTimeZoneBuffer + tzZoneInfoLen);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
#if defined(SEARCH_TZFILE)
|
||||
DefaultTZInfo* tzInfo = (DefaultTZInfo*)uprv_malloc(sizeof(DefaultTZInfo));
|
||||
|
|
@ -1162,7 +1216,8 @@ UInitOnce gTimeZoneFilesInitOnce = U_INITONCE_INITIALIZER;
|
|||
static CharString *gTimeZoneFilesDirectory = NULL;
|
||||
|
||||
#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API
|
||||
static char *gCorrectedPOSIXLocale = NULL; /* Heap allocated */
|
||||
static const char *gCorrectedPOSIXLocale = NULL; /* Sometimes heap allocated */
|
||||
static bool gCorrectedPOSIXLocaleHeapAllocated = false;
|
||||
#endif
|
||||
|
||||
static UBool U_CALLCONV putil_cleanup(void)
|
||||
|
|
@ -1183,9 +1238,10 @@ static UBool U_CALLCONV putil_cleanup(void)
|
|||
#endif
|
||||
|
||||
#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API
|
||||
if (gCorrectedPOSIXLocale) {
|
||||
uprv_free(gCorrectedPOSIXLocale);
|
||||
if (gCorrectedPOSIXLocale && gCorrectedPOSIXLocaleHeapAllocated) {
|
||||
uprv_free(const_cast<char *>(gCorrectedPOSIXLocale));
|
||||
gCorrectedPOSIXLocale = NULL;
|
||||
gCorrectedPOSIXLocaleHeapAllocated = false;
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
|
|
@ -1219,7 +1275,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)) {
|
||||
while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != NULL) {
|
||||
*p = U_FILE_SEP_CHAR;
|
||||
}
|
||||
}
|
||||
|
|
@ -1269,6 +1325,43 @@ uprv_pathIsAbsolute(const char *path)
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if U_PLATFORM_HAS_WINUWP_API != 0
|
||||
// Helper function to get the ICU Data Directory under the Windows directory location.
|
||||
static BOOL U_CALLCONV getIcuDataDirectoryUnderWindowsDirectory(char* directoryBuffer, UINT bufferLength)
|
||||
{
|
||||
#if defined(ICU_DATA_DIR_WINDOWS)
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void U_CALLCONV dataDirectoryInitFn() {
|
||||
/* If we already have the directory, then return immediately. Will happen if user called
|
||||
* u_setDataDirectory().
|
||||
|
|
@ -1297,7 +1390,9 @@ static void U_CALLCONV dataDirectoryInitFn() {
|
|||
*/
|
||||
# if !defined(ICU_NO_USER_DATA_OVERRIDE) && !UCONFIG_NO_FILE_IO
|
||||
/* First try to get the environment variable */
|
||||
path=getenv("ICU_DATA");
|
||||
# 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.
|
||||
|
|
@ -1326,9 +1421,21 @@ static void U_CALLCONV dataDirectoryInitFn() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if U_PLATFORM_HAS_WINUWP_API != 0 && 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. */
|
||||
#if U_PLATFORM_HAS_WIN32_API
|
||||
// Windows UWP will require icudtl.dat file in same directory as icuuc.dll
|
||||
path = ".\\";
|
||||
#else
|
||||
path = "";
|
||||
#endif
|
||||
}
|
||||
|
||||
u_setDataDirectory(path);
|
||||
|
|
@ -1349,7 +1456,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)) {
|
||||
while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != NULL) {
|
||||
*p = U_FILE_SEP_CHAR;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1366,15 +1473,30 @@ static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) {
|
|||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
const char *dir = getenv("ICU_TIMEZONE_FILES_DIR");
|
||||
|
||||
const char *dir = "";
|
||||
|
||||
#if U_PLATFORM_HAS_WINUWP_API != 0
|
||||
// The UWP version does not support the environment variable setting, but can possibly pick them up from the Windows directory.
|
||||
char datadir_path_buffer[MAX_PATH];
|
||||
if (getIcuDataDirectoryUnderWindowsDirectory(datadir_path_buffer, UPRV_LENGTHOF(datadir_path_buffer))) {
|
||||
dir = datadir_path_buffer;
|
||||
}
|
||||
#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.
|
||||
dir = TO_STRING(U_TIMEZONE_FILES_DIR);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dir == NULL) {
|
||||
dir = "";
|
||||
}
|
||||
|
||||
setTimeZoneFilesDir(dir, status);
|
||||
}
|
||||
|
||||
|
|
@ -1546,7 +1668,8 @@ The leftmost codepage (.xxx) wins.
|
|||
/* Note that we scan the *uncorrected* ID. */
|
||||
if ((p = uprv_strrchr(posixID, '@')) != NULL) {
|
||||
if (correctedPOSIXLocale == NULL) {
|
||||
correctedPOSIXLocale = static_cast<char *>(uprv_malloc(uprv_strlen(posixID)+1));
|
||||
/* new locale can be 1 char longer than old one if @ -> __ */
|
||||
correctedPOSIXLocale = static_cast<char *>(uprv_malloc(uprv_strlen(posixID)+2));
|
||||
/* Exit on memory allocation error. */
|
||||
if (correctedPOSIXLocale == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -1563,7 +1686,7 @@ The leftmost codepage (.xxx) wins.
|
|||
}
|
||||
|
||||
if (uprv_strchr(correctedPOSIXLocale,'_') == NULL) {
|
||||
uprv_strcat(correctedPOSIXLocale, "__"); /* aa@b -> aa__b */
|
||||
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 */
|
||||
|
|
@ -1603,6 +1726,7 @@ The leftmost codepage (.xxx) wins.
|
|||
|
||||
if (gCorrectedPOSIXLocale == NULL) {
|
||||
gCorrectedPOSIXLocale = correctedPOSIXLocale;
|
||||
gCorrectedPOSIXLocaleHeapAllocated = true;
|
||||
ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
|
||||
correctedPOSIXLocale = NULL;
|
||||
}
|
||||
|
|
@ -1616,27 +1740,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 = 0;
|
||||
char *correctedPOSIXLocale = nullptr;
|
||||
|
||||
if (gCorrectedPOSIXLocale != NULL) {
|
||||
// If we have already figured this out just use the cached value
|
||||
if (gCorrectedPOSIXLocale != nullptr) {
|
||||
return gCorrectedPOSIXLocale;
|
||||
}
|
||||
|
||||
LCID id = GetThreadLocale();
|
||||
correctedPOSIXLocale = static_cast<char *>(uprv_malloc(POSIX_LOCALE_CAPACITY + 1));
|
||||
if (correctedPOSIXLocale) {
|
||||
int32_t posixLen = uprv_convertToPosix(id, correctedPOSIXLocale, POSIX_LOCALE_CAPACITY, &status);
|
||||
if (U_SUCCESS(status)) {
|
||||
*(correctedPOSIXLocale + posixLen) = 0;
|
||||
gCorrectedPOSIXLocale = correctedPOSIXLocale;
|
||||
ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
|
||||
} else {
|
||||
uprv_free(correctedPOSIXLocale);
|
||||
// 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 (gCorrectedPOSIXLocale == NULL) {
|
||||
return "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;
|
||||
|
||||
|
|
@ -1923,8 +2091,34 @@ int_getDefaultCodepage()
|
|||
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
static char codepage[64];
|
||||
sprintf(codepage, "windows-%d", GetACP());
|
||||
return codepage;
|
||||
DWORD codepageNumber = 0;
|
||||
|
||||
#if U_PLATFORM_HAS_WINUWP_API > 0
|
||||
// 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)
|
||||
{
|
||||
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];
|
||||
|
|
@ -2108,19 +2302,16 @@ u_getVersion(UVersionInfo versionArray) {
|
|||
* icucfg.h dependent code
|
||||
*/
|
||||
|
||||
#if U_ENABLE_DYLOAD
|
||||
|
||||
#if 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__
|
||||
#ifndef __SUSV3
|
||||
#define __SUSV3 1
|
||||
#endif
|
||||
#endif
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#endif /* HAVE_DLFCN_H */
|
||||
|
||||
U_INTERNAL void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
|
|
@ -2160,38 +2351,10 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
|||
return uret.fp;
|
||||
}
|
||||
|
||||
#else
|
||||
#elif U_ENABLE_DYLOAD && U_PLATFORM_USES_ONLY_WIN32_API && !U_PLATFORM_HAS_WINUWP_API
|
||||
|
||||
/* null (nonexistent) implementation. */
|
||||
|
||||
U_INTERNAL void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U_INTERNAL void U_EXPORT2
|
||||
uprv_dl_close(void *lib, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) return;
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
U_INTERNAL UVoidFunction* U_EXPORT2
|
||||
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
||||
if(U_SUCCESS(*status)) {
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
}
|
||||
return (UVoidFunction*)NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
/* 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) {
|
||||
|
|
@ -2218,7 +2381,6 @@ uprv_dl_close(void *lib, UErrorCode *status) {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
U_INTERNAL UVoidFunction* U_EXPORT2
|
||||
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
||||
HMODULE handle = (HMODULE)lib;
|
||||
|
|
@ -2240,10 +2402,9 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
|||
return addr;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/* No dynamic loading set. */
|
||||
/* No dynamic loading, null (nonexistent) implementation. */
|
||||
|
||||
U_INTERNAL void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
|
|
@ -2261,7 +2422,6 @@ uprv_dl_close(void *lib, UErrorCode *status) {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
U_INTERNAL UVoidFunction* U_EXPORT2
|
||||
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
||||
(void)lib;
|
||||
|
|
@ -2272,7 +2432,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
|||
return (UVoidFunction*)NULL;
|
||||
}
|
||||
|
||||
#endif /* U_ENABLE_DYLOAD */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hey, Emacs, please set the following:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
|
|
@ -72,22 +72,13 @@
|
|||
typedef size_t uintptr_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_HAVE_MSVC_2003_OR_EARLIER
|
||||
* Flag for workaround of MSVC 2003 optimization bugs
|
||||
* @internal
|
||||
*/
|
||||
#if !defined(U_HAVE_MSVC_2003_OR_EARLIER) && defined(_MSC_VER) && (_MSC_VER < 1400)
|
||||
#define U_HAVE_MSVC_2003_OR_EARLIER
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/** @{ Information about POSIX support */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef U_HAVE_NL_LANGINFO_CODESET
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM_HAS_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
|
||||
|
|
@ -103,10 +94,13 @@ typedef size_t uintptr_t;
|
|||
# define U_NL_LANGINFO_CODESET CODESET
|
||||
#endif
|
||||
|
||||
#ifdef U_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
|
||||
# define U_TZSET _tzset
|
||||
#endif
|
||||
#elif U_PLATFORM == U_PF_OS400
|
||||
/* not defined */
|
||||
#else
|
||||
|
|
@ -117,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 U_PLATFORM_IS_LINUX_BASED
|
||||
# if 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
|
||||
# endif
|
||||
// not defined
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
# define U_TIMEZONE _timezone
|
||||
#elif U_PLATFORM == U_PF_BSD && !defined(__NetBSD__)
|
||||
|
|
@ -138,10 +132,13 @@ typedef size_t uintptr_t;
|
|||
# define U_TIMEZONE timezone
|
||||
#endif
|
||||
|
||||
#ifdef U_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
|
||||
# define U_TZNAME _tzname
|
||||
#endif
|
||||
#elif U_PLATFORM == U_PF_OS400
|
||||
/* not defined */
|
||||
#else
|
||||
|
|
@ -207,33 +204,21 @@ typedef size_t uintptr_t;
|
|||
|
||||
/**
|
||||
* \def U_HAVE_STD_ATOMICS
|
||||
* Defines whether the standard C++11 <atomic> is available.
|
||||
* ICU will use this when avialable,
|
||||
* otherwise will fall back to compiler or platform specific alternatives.
|
||||
* Defines whether to use the standard C++11 <atomic> functions
|
||||
* If false, ICU will fall back to compiler or platform specific alternatives.
|
||||
* Note: support for these fall back options for atomics will be removed in a future version
|
||||
* of ICU, and the use of C++ 11 atomics will be required.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_HAVE_STD_ATOMICS
|
||||
/* Use the predefined value. */
|
||||
#elif U_CPLUSPLUS_VERSION < 11
|
||||
/* Not C++11, disable use of atomics */
|
||||
# define U_HAVE_STD_ATOMICS 0
|
||||
#elif __clang__ && __clang_major__==3 && __clang_minor__<=1
|
||||
/* Clang 3.1, has atomic variable initializer bug. */
|
||||
# define U_HAVE_STD_ATOMICS 0
|
||||
#else
|
||||
/* U_HAVE_ATOMIC is typically set by an autoconf test of #include <atomic> */
|
||||
/* Can be set manually, or left undefined, on platforms without autoconf. */
|
||||
# if defined(U_HAVE_ATOMIC) && U_HAVE_ATOMIC
|
||||
# define U_HAVE_STD_ATOMICS 1
|
||||
# else
|
||||
# define U_HAVE_STD_ATOMICS 0
|
||||
# endif
|
||||
#else
|
||||
# define U_HAVE_STD_ATOMICS 1
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \def U_HAVE_CLANG_ATOMICS
|
||||
* Defines whether Clang c11 style built-in atomics are avaialable.
|
||||
* Defines whether Clang c11 style built-in atomics are available.
|
||||
* These are used in preference to gcc atomics when both are available.
|
||||
*/
|
||||
#ifdef U_HAVE_CLANG_ATOMICS
|
||||
|
|
@ -271,7 +256,7 @@ typedef size_t uintptr_t;
|
|||
|
||||
/**
|
||||
* Platform utilities isolates the platform dependencies of the
|
||||
* libarary. 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.
|
||||
*/
|
||||
|
||||
|
|
@ -394,6 +379,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);
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Returns the number of digits after the decimal point in a double number x.
|
||||
|
|
@ -419,7 +430,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
|
|||
|
||||
/**
|
||||
* Please use uloc_getDefault() instead.
|
||||
* Return the default locale ID string by querying ths 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.
|
||||
|
|
@ -563,6 +574,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
|
||||
|
||||
/* Dynamic Library Functions */
|
||||
|
||||
typedef void (UVoidFunction)(void);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
658
intl/icu/source/common/rbbi_cache.cpp
Normal file
658
intl/icu/source/common/rbbi_cache.cpp
Normal file
|
|
@ -0,0 +1,658 @@
|
|||
// 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;
|
||||
}
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
fPositionInCache = -1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
fPositionInCache = -1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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()) {
|
||||
U_ASSERT(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
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
|
||||
203
intl/icu/source/common/rbbi_cache.h
Normal file
203
intl/icu/source/common/rbbi_cache.h
Normal file
|
|
@ -0,0 +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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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 "utrie.h"
|
||||
#include "utrie2.h"
|
||||
#include "udatamem.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
|
|
@ -23,23 +23,6 @@
|
|||
#include "uassert.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
//
|
||||
// Trie access folding function. Copied as-is from properties code in uchar.c
|
||||
//
|
||||
//-----------------------------------------------------------------------------------
|
||||
U_CDECL_BEGIN
|
||||
static int32_t U_CALLCONV
|
||||
getFoldingOffset(uint32_t data) {
|
||||
/* if bit 15 is set, then the folding offset is in bits 14..0 of the 16-bit trie result */
|
||||
if(data&0x8000) {
|
||||
return (int32_t)(data&0x7fff);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
U_CDECL_END
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -71,9 +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)
|
||||
// Note: info.fFormatVersion is duplicated in the RBBIDataHeader, and is
|
||||
// validated when checking that.
|
||||
dh->info.dataFormat[3] == 0x20 &&
|
||||
isDataVersionAcceptable(dh->info.formatVersion))
|
||||
) {
|
||||
status = U_INVALID_FORMAT_ERROR;
|
||||
return;
|
||||
|
|
@ -84,6 +66,11 @@ RBBIDataWrapper::RBBIDataWrapper(UDataMemory* udm, UErrorCode &status) {
|
|||
fUDataMem = udm;
|
||||
}
|
||||
|
||||
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
|
||||
|
|
@ -94,12 +81,11 @@ void RBBIDataWrapper::init0() {
|
|||
fHeader = NULL;
|
||||
fForwardTable = NULL;
|
||||
fReverseTable = NULL;
|
||||
fSafeFwdTable = NULL;
|
||||
fSafeRevTable = NULL;
|
||||
fRuleSource = NULL;
|
||||
fRuleSource = NULL;
|
||||
fRuleStatusTable = NULL;
|
||||
fUDataMem = NULL;
|
||||
fRefCount = 0;
|
||||
fTrie = NULL;
|
||||
fUDataMem = NULL;
|
||||
fRefCount = 0;
|
||||
fDontFreeData = TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -108,8 +94,7 @@ void RBBIDataWrapper::init(const RBBIDataHeader *data, UErrorCode &status) {
|
|||
return;
|
||||
}
|
||||
fHeader = data;
|
||||
if (fHeader->fMagic != 0xb1a0 || fHeader->fFormatVersion[0] != 3)
|
||||
{
|
||||
if (fHeader->fMagic != 0xb1a0 || !isDataVersionAcceptable(fHeader->fFormatVersion)) {
|
||||
status = U_INVALID_FORMAT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
|
@ -124,23 +109,15 @@ void RBBIDataWrapper::init(const RBBIDataHeader *data, UErrorCode &status) {
|
|||
if (data->fRTableLen != 0) {
|
||||
fReverseTable = (RBBIStateTable *)((char *)data + fHeader->fRTable);
|
||||
}
|
||||
if (data->fSFTableLen != 0) {
|
||||
fSafeFwdTable = (RBBIStateTable *)((char *)data + fHeader->fSFTable);
|
||||
}
|
||||
if (data->fSRTableLen != 0) {
|
||||
fSafeRevTable = (RBBIStateTable *)((char *)data + fHeader->fSRTable);
|
||||
}
|
||||
|
||||
|
||||
utrie_unserialize(&fTrie,
|
||||
(uint8_t *)data + fHeader->fTrie,
|
||||
fHeader->fTrieLen,
|
||||
&status);
|
||||
fTrie = utrie2_openFromSerialized(UTRIE2_16_VALUE_BITS,
|
||||
(uint8_t *)data + fHeader->fTrie,
|
||||
fHeader->fTrieLen,
|
||||
NULL, // *actual length
|
||||
&status);
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
fTrie.getFoldingOffset=getFoldingOffset;
|
||||
|
||||
|
||||
fRuleSource = (UChar *)((char *)data + fHeader->fRuleSource);
|
||||
fRuleString.setTo(TRUE, fRuleSource, -1);
|
||||
|
|
@ -165,6 +142,8 @@ void RBBIDataWrapper::init(const RBBIDataHeader *data, UErrorCode &status) {
|
|||
//-----------------------------------------------------------------------------
|
||||
RBBIDataWrapper::~RBBIDataWrapper() {
|
||||
U_ASSERT(fRefCount == 0);
|
||||
utrie2_close(fTrie);
|
||||
fTrie = NULL;
|
||||
if (fUDataMem) {
|
||||
udata_close(fUDataMem);
|
||||
} else if (!fDontFreeData) {
|
||||
|
|
@ -271,8 +250,8 @@ void RBBIDataWrapper::printTable(const char *heading, const RBBIStateTable *tab
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef RBBI_DEBUG
|
||||
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],
|
||||
fHeader->fFormatVersion[2], fHeader->fFormatVersion[3]);
|
||||
|
|
@ -281,16 +260,14 @@ void RBBIDataWrapper::printData() {
|
|||
|
||||
printTable("Forward State Transition Table", fForwardTable);
|
||||
printTable("Reverse State Transition Table", fReverseTable);
|
||||
printTable("Safe Forward State Transition Table", fSafeFwdTable);
|
||||
printTable("Safe Reverse State Transition Table", fSafeRevTable);
|
||||
|
||||
RBBIDebugPrintf("\nOrignal Rules source:\n");
|
||||
for (int32_t c=0; fRuleSource[c] != 0; c++) {
|
||||
RBBIDebugPrintf("%c", fRuleSource[c]);
|
||||
}
|
||||
RBBIDebugPrintf("\n\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
|
@ -323,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 &&
|
||||
pInfo->formatVersion[0]==3 )) {
|
||||
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],
|
||||
|
|
@ -344,17 +321,11 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD
|
|||
//
|
||||
// Get the RRBI Data Header, and check that it appears to be OK.
|
||||
//
|
||||
// Note: ICU 3.2 and earlier, RBBIDataHeader::fDataFormat was actually
|
||||
// an int32_t with a value of 1. Starting with ICU 3.4,
|
||||
// RBBI's fDataFormat matches the dataFormat field from the
|
||||
// UDataInfo header, four int8_t bytes. The value is {3,1,0,0}
|
||||
//
|
||||
const uint8_t *inBytes =(const uint8_t *)inData+headerSize;
|
||||
RBBIDataHeader *rbbiDH = (RBBIDataHeader *)inBytes;
|
||||
if (ds->readUInt32(rbbiDH->fMagic) != 0xb1a0 ||
|
||||
rbbiDH->fFormatVersion[0] != 3 ||
|
||||
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;
|
||||
|
|
@ -428,31 +399,9 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD
|
|||
outBytes+tableStartOffset+topSize, status);
|
||||
}
|
||||
|
||||
// Safe Forward state table. Same layout as forward table, above.
|
||||
tableStartOffset = ds->readUInt32(rbbiDH->fSFTable);
|
||||
tableLength = ds->readUInt32(rbbiDH->fSFTableLen);
|
||||
|
||||
if (tableLength > 0) {
|
||||
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
|
||||
outBytes+tableStartOffset, status);
|
||||
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
|
||||
outBytes+tableStartOffset+topSize, status);
|
||||
}
|
||||
|
||||
// Safe Reverse state table. Same layout as forward table, above.
|
||||
tableStartOffset = ds->readUInt32(rbbiDH->fSRTable);
|
||||
tableLength = ds->readUInt32(rbbiDH->fSRTableLen);
|
||||
|
||||
if (tableLength > 0) {
|
||||
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
|
||||
outBytes+tableStartOffset, status);
|
||||
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
|
||||
outBytes+tableStartOffset+topSize, status);
|
||||
}
|
||||
|
||||
// Trie table for character categories
|
||||
utrie_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),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -51,22 +51,23 @@ ubrk_swap(const UDataSwapper *ds,
|
|||
|
||||
#include "unicode/uobject.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/uversion.h"
|
||||
#include "umutex.h"
|
||||
#include "utrie.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 following structs map exactly onto the raw data from ICU common data file.
|
||||
*/
|
||||
struct RBBIDataHeader {
|
||||
uint32_t fMagic; /* == 0xbla0 */
|
||||
uint8_t fFormatVersion[4]; /* 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) */
|
||||
/* For ICU 3.2 and earlier, this field was */
|
||||
/* uint32_t fVersion */
|
||||
/* with a value of 1. */
|
||||
uint32_t fLength; /* Total length in bytes of this RBBI Data, */
|
||||
/* including all sections, not just the header. */
|
||||
uint32_t fCatCount; /* Number of character categories. */
|
||||
|
|
@ -80,10 +81,6 @@ struct RBBIDataHeader {
|
|||
uint32_t fFTableLen;
|
||||
uint32_t fRTable; /* Offset to the reverse state transition table. */
|
||||
uint32_t fRTableLen;
|
||||
uint32_t fSFTable; /* safe point forward transition table */
|
||||
uint32_t fSFTableLen;
|
||||
uint32_t fSRTable; /* safe point reverse transition table */
|
||||
uint32_t fSRTableLen;
|
||||
uint32_t fTrie; /* Offset to Trie data for character categories */
|
||||
uint32_t fTrieLen;
|
||||
uint32_t fRuleSource; /* Offset to the source for for the break */
|
||||
|
|
@ -115,9 +112,10 @@ struct RBBIStateTableRow {
|
|||
/* StatusTable of the set of matching */
|
||||
/* tags (rule status values) */
|
||||
int16_t fReserved;
|
||||
uint16_t fNextState[2]; /* Next State, indexed by char category. */
|
||||
/* This array does not have two elements */
|
||||
/* 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. */
|
||||
};
|
||||
|
|
@ -128,7 +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[4]; /* First RBBIStateTableRow begins here. */
|
||||
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,6 +152,8 @@ public:
|
|||
RBBIDataWrapper(UDataMemory* udm, UErrorCode &status);
|
||||
~RBBIDataWrapper();
|
||||
|
||||
static UBool isDataVersionAcceptable(const UVersionInfo version);
|
||||
|
||||
void init0();
|
||||
void init(const RBBIDataHeader *data, UErrorCode &status);
|
||||
RBBIDataWrapper *addReference();
|
||||
|
|
@ -159,13 +161,8 @@ public:
|
|||
UBool operator ==(const RBBIDataWrapper &other) const;
|
||||
int32_t hashCode();
|
||||
const UnicodeString &getRuleSourceString() const;
|
||||
#ifdef RBBI_DEBUG
|
||||
void printData();
|
||||
void printTable(const char *heading, const RBBIStateTable *table);
|
||||
#else
|
||||
#define printData()
|
||||
#define printTable(heading, table)
|
||||
#endif
|
||||
|
||||
/* */
|
||||
/* Pointers to items within the data */
|
||||
|
|
@ -173,19 +170,17 @@ public:
|
|||
const RBBIDataHeader *fHeader;
|
||||
const RBBIStateTable *fForwardTable;
|
||||
const RBBIStateTable *fReverseTable;
|
||||
const RBBIStateTable *fSafeFwdTable;
|
||||
const RBBIStateTable *fSafeRevTable;
|
||||
const UChar *fRuleSource;
|
||||
const int32_t *fRuleStatusTable;
|
||||
|
||||
/* number of int32_t values in the rule status table. Used to sanity check indexing */
|
||||
int32_t fStatusMaxIdx;
|
||||
|
||||
UTrie fTrie;
|
||||
UTrie2 *fTrie;
|
||||
|
||||
private:
|
||||
u_atomic_int32_t fRefCount;
|
||||
UDataMemory *fUDataMem;
|
||||
UDataMemory *fUDataMem;
|
||||
UnicodeString fRuleString;
|
||||
UBool fDontFreeData;
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue